Skip to content

Instantly share code, notes, and snippets.

@goto-bus-stop
Created May 5, 2019 15:56
Show Gist options
  • Save goto-bus-stop/d65ac2a3b005fd7d6b7432ea6ca4a4da to your computer and use it in GitHub Desktop.
Save goto-bus-stop/d65ac2a3b005fd7d6b7432ea6ca4a4da to your computer and use it in GitHub Desktop.
var createModuleFactory = /* -- snip -- */
var _$lazy_4 = createModuleFactory(function (module, exports) {
// lazy.js
console.log('lazy')
});
var _$conditional_3 = createModuleFactory(function (module, exports) {
// conditional.js
console.log('conditional')
});
var _$always_2 = {};
// always.js
console.log('always')
// module.js
// Inlined _before_ the code in module.js:
_$always_2;
if (Math.random() > 0.5) {
// Evaluated only if the condition is true:
_$conditional_3({})
}
module.exports = function () {
// Evaluated once this function is first called:
return _$lazy_4({})
}
// module.js
// Inlined _before_ the code in module.js:
require('always')
if (Math.random() > 0.5) {
// Evaluated only if the condition is true:
require('conditional')
}
module.exports = function () {
// Evaluated once this function is first called:
return require('lazy')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment