Skip to content

Commit

Permalink
fix: Stop babel from rewriting babel helpers in core-js. (#2116)
Browse files Browse the repository at this point in the history
- Prevents `@babel/plugin-transform-runtime` from rewriting babel helpers in core-js.
- Remove unneeded runtime `@babel/runtime-corejs3`

cc: rails/webpacker#2031, rails/webpacker#2109
  • Loading branch information
jakeNiemiec authored and gauravtiwari committed Jun 3, 2019
1 parent 189e151 commit 2d46a93
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
**Please note that Webpacker 3.1.0 and 3.1.1 have some serious bugs so please consider using either 3.0.2 or 3.2.0**

## [[4.0.7]](https://github.com/rails/webpacker/compare/v4.0.6...v4.0.7) - 2019-06-03

- Prevent `@babel/plugin-transform-runtime` from rewriting babel helpers in core-js. Remove unneeded runtime `@babel/runtime-corejs3` [#2116](https://github.com/rails/webpacker/pull/2116)
- Fix for: [#2109 Uncaught TypeError: __webpack_require__(...) is not a function](https://github.com/rails/webpacker/issues/2109): **If you are upgrading**, please check your `babel.config.js` against the [default `babel.config.js`](https://github.com/rails/webpacker/blob/master/lib/install/config/babel.config.js):
- `@babel/preset-env` should contain `corejs: 3`
- `@babel/plugin-transform-runtime` should contain `corejs: false`
- Removed unneeded runtime `@babel/runtime-corejs3`

## [[4.0.6]](https://github.com/rails/webpacker/compare/v4.0.5...v4.0.6) - 2019-05-30

- Webpack should not be transpiled [#2111](https://github.com/rails/webpacker/pull/2111)
Expand All @@ -16,7 +24,7 @@

Please see the diff

### Breaking changes
##### Breaking changes (for pre-existing apps)

- [`@babel/polyfill`](https://babeljs.io/docs/en/next/babel-polyfill.html) [doesn't make it possible to provide a smooth migration path from `core-js@2` to `core-js@3`](https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#babelpolyfill): for this reason, it was decided to deprecate `@babel/polyfill` in favor of separate inclusion of required parts of `core-js` and `regenerator-runtime`. [#2031](https://github.com/rails/webpacker/pull/2031)

Expand Down
2 changes: 1 addition & 1 deletion lib/install/config/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module.exports = function(api) {
{
helpers: false,
regenerator: true,
corejs: 3
corejs: false
}
],
[
Expand Down
3 changes: 2 additions & 1 deletion lib/install/examples/react/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ module.exports = function(api) {
require('@babel/plugin-transform-runtime').default,
{
helpers: false,
regenerator: true
regenerator: true,
corejs: false
}
],
[
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@babel/runtime": "^7.4.5",
"@babel/runtime-corejs3": "^7.4.5",
"babel-loader": "^8.0.6",
"babel-plugin-dynamic-import-node": "^2.2.0",
"babel-plugin-macros": "^2.5.0",
Expand Down
10 changes: 1 addition & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -622,14 +622,6 @@
js-levenshtein "^1.1.3"
semver "^5.5.0"

"@babel/runtime-corejs3@^7.4.5":
version "7.4.5"
resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.4.5.tgz#7df89702351c5fdc34b5555544fcf11b4ea7051c"
integrity sha512-yxHpUObdpx4zbuLJOHIZkw43E4NbWGsGH+85kRUj+VEcdtjlqI0vDcAja9mwOHqD7/4vCZp69q6eztz/sFDibQ==
dependencies:
core-js-pure "^3.0.0"
regenerator-runtime "^0.13.2"

"@babel/runtime@^7.4.2", "@babel/runtime@^7.4.5":
version "7.4.5"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.4.5.tgz#582bb531f5f9dc67d2fcb682979894f75e253f12"
Expand Down Expand Up @@ -1992,7 +1984,7 @@ core-js-compat@^3.1.1:
core-js-pure "3.1.3"
semver "^6.1.0"

core-js-pure@3.1.3, core-js-pure@^3.0.0:
core-js-pure@3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.1.3.tgz#4c90752d5b9471f641514f3728f51c1e0783d0b5"
integrity sha512-k3JWTrcQBKqjkjI0bkfXS0lbpWPxYuHWfMMjC1VDmzU4Q58IwSbuXSo99YO/hUHlw/EB4AlfA2PVxOGkrIq6dA==
Expand Down

0 comments on commit 2d46a93

Please sign in to comment.