Set modules to false in babel

Version 2 of webpack supports ES6 modules syntax natively, meaning you can use import and export without a tool like babel to handle this for you.

So when we config babel-preset-env we can set “modules” to false, instead of using babel to compiling then into other module type.

babel-polyfill and babel-runtime

Use @babel/runtime when you don’t want to pollute global namespace(e.g. you are building a library).

Install @babel/plugin-transform-runtime as development dependency.

1
npm install --save-dev @babel/plugin-transform-runtime

Install @babel/runtime as a production dependency.

1
npm install --save @babel/runtime

Use @babel/polyfill for writing an app.

Source: https://babeljs.io/docs/en/babel-plugin-transform-runtime