babel-plugin-transform-require-on-use
v2.1.0
Published
This is a babel transform that conceptually transforms this:
Downloads
4
Readme
transform-require-on-use
This is a babel transform that conceptually transforms this:
const module = require("module");
function somewhere () {
if (condition) {
module.doSomething();
}
}
into this:
const module = () => require("module");
function somewhere () {
if (condition) {
module().doSomething();
}
}
That's it!
Caveats
Modules with that have require-time side-effects will obviously not play well with this.
v1.0.0 is super naive, let's see where it goes.