This preset is no longer necessary as the function that it performed can now be achieved natively.
Instead of es2015-native-modules
please use es2015
with { "modules": false }
option:
presets: [
["es2015", { "modules": false }]
]
- babel-plugin-transform-es2015-modules-commonjs
– A preset without transform-es2015-modules-commonjs would help with tree-shaking when using Babel 6 and webpack 2
Tree-shaking with webpack 2 and Babel 6
$ npm install --save-dev babel-preset-es2015-native-modules
.babelrc
{
"presets": ["es2015-native-modules"]
}
$ babel script.js --presets es2015-native-modules
require("babel-core").transform("code", {
presets: ["es2015-native-modules"]
});