Skip to content

Added an option to enable polyfill for Babel Transform Runtime plugin #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
Expand Down
2 changes: 1 addition & 1 deletion config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
Expand Down
8 changes: 8 additions & 0 deletions template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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`.