Babel + core-js
-
npm run babel
- Creates
babel/code.js
fromsrc/code.js
with Babel transformations - Uses just
@babel/preset-env
, with no additional configuration @babel/preset-env
uses.browserslistrc
to decide what to transform and how
- Creates
-
npm run babel-core-js
- Creates
babel-core-js/code.js
- Uses
cross-env
to changeNODE_ENV
- Then,
@babel/preset-env
usescore-js
(see.babelrc.js
) @babel/preset-env
uses.browserslistrc
to decide what to transform and polyfill and how
- Creates
-
npm run docs
- Creates
docs
folder with- polyfill.html
- babel-core-js.js
- original.html
- original.js
- Executes webpack 2 times - with the original file (default configuration) and with the Babel + core-js version (
webpack-babel-core-js.js
webpack configuration)
- Creates
Example in action
Why not using Babel inside Webpack?
The idea is to show Babel and core-js. It's simpler with Babel CLI.
Webpack is just for creating the example webpages with the code got from Babel.