UNPKG

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