Skip to content

Commit d701684

Browse files
somebody32gauravtiwari
authored andcommitted
deprecates babel/polyfill in favor of core-js@3 (#2031)
1 parent 208da39 commit d701684

File tree

6 files changed

+389
-221
lines changed

6 files changed

+389
-221
lines changed

docs/es6.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ Following ES6/7 features are supported out of the box:
1616
* Dynamic import() - useful for route level code-splitting
1717
* Class Fields and Static Properties.
1818

19-
We have also included [babel polyfill](https://babeljs.io/docs/usage/polyfill/)
20-
that includes a custom regenerator runtime and core-js.
19+
We have also included [core-js](https://github.com/zloirock/core-js) to polyfill features in the
20+
older browsers.
2121

22-
Don't forget to import `@babel/polyfill` in your main entry point like so:
22+
Don't forget to add these lines into your main entry point:
2323

2424
```js
25-
import "@babel/polyfill"
25+
import "core-js/stable";
26+
import "regenerator-runtime/runtime";
2627
```
2728

2829

lib/install/config/babel.config.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ module.exports = function(api) {
3030
{
3131
forceAllTransforms: true,
3232
useBuiltIns: 'entry',
33+
corejs: 3,
3334
modules: false,
3435
exclude: ['transform-typeof-symbol']
3536
}
@@ -56,7 +57,8 @@ module.exports = function(api) {
5657
require('@babel/plugin-transform-runtime').default,
5758
{
5859
helpers: false,
59-
regenerator: true
60+
regenerator: true,
61+
corejs: 3
6062
}
6163
],
6264
[

lib/install/examples/react/babel.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ module.exports = function(api) {
3030
{
3131
forceAllTransforms: true,
3232
useBuiltIns: 'entry',
33+
corejs: 3,
3334
modules: false,
3435
exclude: ['transform-typeof-symbol']
3536
}

package.json

+11-9
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,22 @@
1212
"yarn": ">=1.0.0"
1313
},
1414
"dependencies": {
15-
"@babel/core": "^7.3.4",
16-
"@babel/plugin-proposal-class-properties": "^7.3.4",
17-
"@babel/plugin-proposal-object-rest-spread": "^7.3.4",
15+
"@babel/core": "^7.4.0",
16+
"@babel/plugin-proposal-class-properties": "^7.4.0",
17+
"@babel/plugin-proposal-object-rest-spread": "^7.4.0",
1818
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
19-
"@babel/plugin-transform-destructuring": "^7.3.2",
20-
"@babel/plugin-transform-regenerator": "^7.3.4",
21-
"@babel/plugin-transform-runtime": "^7.3.4",
22-
"@babel/polyfill": "^7.2.5",
23-
"@babel/preset-env": "^7.3.4",
24-
"@babel/runtime": "^7.3.4",
19+
"@babel/plugin-transform-destructuring": "^7.4.0",
20+
"@babel/plugin-transform-regenerator": "^7.4.0",
21+
"@babel/plugin-transform-runtime": "^7.4.0",
22+
"@babel/preset-env": "^7.4.0",
23+
"@babel/runtime": "^7.4.0",
24+
"@babel/runtime-corejs3": "^7.4.3",
2525
"babel-loader": "^8.0.5",
2626
"babel-plugin-dynamic-import-node": "^2.2.0",
2727
"babel-plugin-macros": "^2.5.0",
2828
"case-sensitive-paths-webpack-plugin": "^2.2.0",
2929
"compression-webpack-plugin": "^2.0.0",
30+
"core-js": "^3.0.0",
3031
"css-loader": "^2.1.1",
3132
"file-loader": "^3.0.1",
3233
"flatted": "^2.0.0",
@@ -42,6 +43,7 @@
4243
"postcss-loader": "^3.0.0",
4344
"postcss-preset-env": "^6.6.0",
4445
"postcss-safe-parser": "^4.0.1",
46+
"regenerator-runtime": "^0.13.2",
4547
"sass-loader": "^7.1.0",
4648
"style-loader": "^0.23.1",
4749
"terser-webpack-plugin": "^1.2.3",

package/rules/node_modules.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const { nodeEnv } = require('../env')
66
module.exports = {
77
test: /\.(js|mjs)$/,
88
include: /node_modules/,
9-
exclude: /@babel(?:\/|\\{1,2})runtime/,
9+
exclude: /@babel(?:\/|\\{1,2})runtime|core-js/,
1010
use: [
1111
{
1212
loader: 'babel-loader',

0 commit comments

Comments
 (0)