utils.js 757 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. 'use strict';
  2. /**
  3. * Lazily-required module dependencies (makes the application
  4. * faster)
  5. */
  6. var utils = require('lazy-cache')(require);
  7. /**
  8. * Temporarily re-assign `require` to trick browserify and
  9. * webpack into reconizing lazy dependencies.
  10. *
  11. * This tiny bit of ugliness has the huge dual advantage of
  12. * only loading modules that are actually called at some
  13. * point in the lifecycle of the application, whilst also
  14. * allowing browserify and webpack to find modules that
  15. * are depended on but never actually called.
  16. */
  17. var fn = require;
  18. require = utils;
  19. /**
  20. * Lazily required module dependencies
  21. */
  22. require('align-text', 'align');
  23. /**
  24. * Restore `require`
  25. */
  26. require = fn;
  27. /**
  28. * Expose `utils` modules
  29. */
  30. module.exports = utils;