diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js index 81751808..ec462016 100644 --- a/config/webpack.config.dev.js +++ b/config/webpack.config.dev.js @@ -99,7 +99,7 @@ module.exports = { require.resolve('babel-plugin-transform-runtime'), { helpers: false, - polyfill: false, + polyfill: process.env.BABEL_TRANSFORM_RUNTIME_POLYFILL === 'true' ? true : false, regenerator: true } ] diff --git a/config/webpack.config.prod.js b/config/webpack.config.prod.js index 7ba710e4..68325e01 100644 --- a/config/webpack.config.prod.js +++ b/config/webpack.config.prod.js @@ -122,7 +122,7 @@ module.exports = { require.resolve('babel-plugin-transform-runtime'), { helpers: false, - polyfill: false, + polyfill: process.env.BABEL_TRANSFORM_RUNTIME_POLYFILL === 'true' ? true : false, regenerator: true } ] diff --git a/template/README.md b/template/README.md index c3626bd3..7e6c04b3 100644 --- a/template/README.md +++ b/template/README.md @@ -49,6 +49,7 @@ You can find the most recent version of this guide [here](https://github.com/hal * [Static Server](#static-server) * [GitHub Pages](#github-pages) * [IDE setup for Hot Module Replacement](#ide-setup-for-hot-module-replacement) +* [Babel Transform Runtime plugin options](#babel-transform-runtime-plugin-options) ## Sending feedback @@ -850,3 +851,10 @@ GitHub Pages doesn’t support routers that use the HTML5 `pushState` history AP ## IDE setup for Hot Module Replacement Remember to disable [safe write](https://webpack.github.io/docs/webpack-dev-server.html#working-with-editors-ides-supporting-safe-write) if you are using VIM or IntelliJ IDE, such as WebStorm. + +## Babel Transform Runtime plugin options + +By default, Babel Transform Runtime plugin is configured to **not** transform new built-ins (Promise, Set, Map, etc.) to use a non-global polluting polyfill ([Babel Runtime transform plugin documentation](https://babeljs.io/docs/plugins/transform-runtime/)). + +To enable this transformation set `BABEL_TRANSFORM_RUNTIME_POLYFILL` environment variable to `true`. +