babel-plugin-transform-modules-esl
Installation
$ npm install babel-plugin-transform-modules-esl --save-dev
Usage
Via .babelrc
(Recommended)
.babelrc
{
"plugins": ["transform-modules-esl"]
}
Via CLI
$ babel --plugins transform-modules-esl script.js
Via Node API
require("babel-core").transform("code", {
plugins: ["transform-modules-esl"]
});
because of the difference between es2015 module
and amd module
,
this plugin don't support named export
and default export
at the same time.
import * as foo from 'foo'
and import foo from 'foo'
are equalexport foo; export default foo;
will throw: 'esl module don't support export default foo
and , export foo
both, please choose one