babel-plugin-transform-import-commonjs
Fork of https://github.com/kiurchv/babel-plugin-transform-system-import-commonjs that compiles import
instead of System.import
, now that the import()
proposal has been accepted.
Babel plugin that transforms ES2015 import into CommonJS require.
https://github.com/tc39/proposal-dynamic-import
How this works
This plugin transforms
var myModule = "./path/to/myModule"; importmyModule;
to
var myModule = "./path/to/myModule"; { ;};
Requirements
You need support for Promise, use polyfill if needed.
Installation
$ npm install babel-plugin-transform-import-commonjs
Usage
.babelrc
(Recommended)
Via .babelrc
"plugins": "transform-import-commonjs"
Via CLI
$ babel --plugins transform-import-commonjs script.js
Via Node API
;