babel-plugin-transform-dynamic-import
v2.1.0
Published
Babel plugin to transpile import() to a deferred require(), for node
Downloads
166,561
Readme
babel-plugin-transform-dynamic-import
Babel plugin to transpile import()
to a deferred require()
, for node. Matches the proposed spec.
NOTE: Babylon >= v6.12.0 is required to correct parse dynamic imports.
Installation
$ npm install babel-plugin-transform-dynamic-import --save-dev
Usage
Via .babelrc
(Recommended)
.babelrc
{
"plugins": ["transform-dynamic-import"]
}
Via CLI
$ babel --plugins transform-dynamic-import script.js
Via Node API
require('@babel/core').transform('code', {
plugins: ['transform-dynamic-import']
});