Skip to content

Commit

Permalink
Naively attempt to fix bustage due to Babel update
Browse files Browse the repository at this point in the history
Seeing a lot of:

    _Object$defineProperty is not a function

Scanning the release notes:

    https://github.com/babel/babel/releases

This one stands out:

    https://github.com/babel/babel/releases/tag/v7.4.0

Specifically, "Update to core-js@3":

    babel/babel#7646

There are 133 comments which I confess to not having read, and various
offshoots to places like:

    babel/babel#9442

and:

    facebook/regenerator#369

I did find this enormous update doc, but haven't found the answer in
there yet and the Babel docs themselves don't appear to have been
updated:

    https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md

Although this blog post is briefer and covers a few things:

    https://babeljs.io/blog/2019/03/19/7.4.0

In the end the build works if I get rid of
`@babel/plugin-transform-runtime`, which doesn't seem to play too well
in conjunction with `@babel/preset-env`, at least in this set-up.
  • Loading branch information
wincent committed Mar 31, 2019
1 parent a8ab332 commit 62298c1
Show file tree
Hide file tree
Showing 17 changed files with 68 additions and 58 deletions.
50 changes: 24 additions & 26 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,17 @@ module.exports = function(api) {
presets: [
// Avoid "ReferenceError: regeneratorRuntime is not defined"
// in Jest runs that use async functions.
['@babel/preset-env', {targets: {node: 'current'}}],
[
'@babel/preset-env',
{
corejs: {
proposals: true,
version: 3,
},
targets: {node: 'current'},
useBuiltIns: 'usage',
},
],
['@babel/preset-typescript', {isTSX: true, allExtensions: true}],
],
},
Expand All @@ -107,18 +117,18 @@ module.exports = function(api) {
plugins: [
getMinifyReplaceConfig('development'),
wrapLocal('@wincent/babel-plugin-invariant-transform'),
],
presets: [
[
'@babel/plugin-transform-runtime',
'@babel/preset-env',
{
corejs: 2,
helpers: true,
regenerator: true,
useESModules: false,
corejs: {
proposals: true,
version: 3,
},
useBuiltIns: 'usage',
},
],
],
presets: [
['@babel/preset-env', {}],
['@babel/preset-typescript', {isTSX: true, allExtensions: true}],
],
},
Expand All @@ -130,18 +140,15 @@ module.exports = function(api) {
'@wincent/babel-plugin-invariant-transform',
{strip: true},
]),
],
presets: [
[
'@babel/plugin-transform-runtime',
'@babel/preset-env',
{
corejs: 2,
helpers: true,
regenerator: true,
useESModules: false,
corejs: 3,
useBuiltIns: 'usage',
},
],
],
presets: [
['@babel/preset-env', {}],
['@babel/preset-typescript', {isTSX: true, allExtensions: true}],
['minify', babelMinifyOptions],
],
Expand All @@ -154,15 +161,6 @@ module.exports = function(api) {
'@wincent/babel-plugin-invariant-transform',
{strip: true},
]),
[
'@babel/plugin-transform-runtime',
{
corejs: false /* assume Polyfill by user */,
helpers: false,
regenerator: false,
useESModules: true,
},
],
],
presets: [
['@babel/preset-env', {modules: false, targets: {esmodules: true}}],
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"@babel/core": "*",
"@babel/parser": "*",
"@babel/plugin-syntax-dynamic-import": "*",
"@babel/plugin-transform-runtime": "*",
"@babel/preset-env": "*",
"@babel/preset-typescript": "*",
"@babel/traverse": "*",
Expand Down
3 changes: 2 additions & 1 deletion packages/babel-plugin-invariant-transform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
},
"dependencies": {
"@babel/core": "*",
"@babel/runtime-corejs2": "7.4.2"
"@babel/runtime-corejs3": "7.4.2",
"core-js": "3.0.0"
}
}
3 changes: 3 additions & 0 deletions packages/clamp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@
},
"devDependencies": {
"@wincent/workspace-scripts": "0.0.1"
},
"dependencies": {
"core-js": "3.0.0"
}
}
3 changes: 3 additions & 0 deletions packages/debounce/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@
},
"devDependencies": {
"@wincent/workspace-scripts": "0.0.1"
},
"dependencies": {
"core-js": "3.0.0"
}
}
3 changes: 2 additions & 1 deletion packages/dedent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"typecheck:ts": "workspace-scripts typecheck:ts"
},
"dependencies": {
"@babel/runtime-corejs2": "7.4.2"
"@babel/runtime-corejs3": "7.4.2",
"core-js": "3.0.0"
},
"devDependencies": {
"@wincent/workspace-scripts": "0.0.1"
Expand Down
5 changes: 3 additions & 2 deletions packages/delay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
"typecheck:ts": "workspace-scripts typecheck:ts"
},
"dependencies": {
"@babel/runtime-corejs2": "7.4.2",
"@wincent/invariant": "0.0.1"
"@babel/runtime-corejs3": "7.4.2",
"@wincent/invariant": "0.0.1",
"core-js": "3.0.0"
},
"devDependencies": {
"@wincent/workspace-scripts": "0.0.1"
Expand Down
3 changes: 3 additions & 0 deletions packages/escape-html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@
},
"devDependencies": {
"@wincent/workspace-scripts": "0.0.1"
},
"dependencies": {
"core-js": "3.0.0"
}
}
3 changes: 2 additions & 1 deletion packages/event-emitter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"typecheck:ts": "workspace-scripts typecheck:ts"
},
"dependencies": {
"@babel/runtime-corejs2": "7.4.2"
"@babel/runtime-corejs3": "7.4.2",
"core-js": "3.0.0"
},
"devDependencies": {
"@wincent/workspace-scripts": "0.0.1"
Expand Down
3 changes: 3 additions & 0 deletions packages/indent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@
},
"devDependencies": {
"@wincent/workspace-scripts": "0.0.1"
},
"dependencies": {
"core-js": "3.0.0"
}
}
3 changes: 3 additions & 0 deletions packages/invariant/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@
},
"devDependencies": {
"@wincent/workspace-scripts": "0.0.1"
},
"dependencies": {
"core-js": "3.0.0"
}
}
3 changes: 3 additions & 0 deletions packages/is-object/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@
},
"devDependencies": {
"@wincent/workspace-scripts": "0.0.1"
},
"dependencies": {
"core-js": "3.0.0"
}
}
3 changes: 3 additions & 0 deletions packages/nullthrows/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@
},
"devDependencies": {
"@wincent/workspace-scripts": "0.0.1"
},
"dependencies": {
"core-js": "3.0.0"
}
}
5 changes: 3 additions & 2 deletions packages/stable-stringify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
"typecheck:ts": "workspace-scripts typecheck:ts"
},
"dependencies": {
"@babel/runtime-corejs2": "7.4.2",
"@wincent/is-object": "0.0.1"
"@babel/runtime-corejs3": "7.4.2",
"@wincent/is-object": "0.0.1",
"core-js": "3.0.0"
},
"devDependencies": {
"@wincent/workspace-scripts": "0.0.1"
Expand Down
6 changes: 4 additions & 2 deletions packages/workspace-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
},
"dependencies": {
"@babel/parser": "7.4.2",
"@babel/runtime-corejs2": "7.4.2",
"@babel/traverse": "7.4.0"
"@babel/runtime-corejs3": "7.4.2",
"@babel/traverse": "7.4.0",
"core-js": "3.0.0",
"regenerator-runtime": "0.13.2"
}
}
2 changes: 1 addition & 1 deletion packages/workspace-scripts/src/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async function forEachSourceFile(name: string, callback: Callback) {
/**
* Extracts a dependency name from a require target such as:
*
* @babel/runtime-corejs2/core-js/set
* @babel/runtime-corejs3/core-js/set
* ^^^^^^^^^^^^^^^^^^^^^^
*
* or:
Expand Down
27 changes: 6 additions & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -495,16 +495,6 @@
dependencies:
regenerator-transform "^0.13.4"

"@babel/plugin-transform-runtime@*":
version "7.4.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.4.0.tgz#b4d8c925ed957471bc57e0b9da53408ebb1ed457"
integrity sha512-1uv2h9wnRj98XX3g0l4q+O3jFM6HfayKup7aIu4pnnlzGz0H+cYckGBC74FZIWJXJSXAmeJ9Yu5Gg2RQpS4hWg==
dependencies:
"@babel/helper-module-imports" "^7.0.0"
"@babel/helper-plugin-utils" "^7.0.0"
resolve "^1.8.1"
semver "^5.5.1"

"@babel/plugin-transform-shorthand-properties@^7.2.0":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.2.0.tgz#6333aee2f8d6ee7e28615457298934a3b46198f0"
Expand Down Expand Up @@ -618,12 +608,12 @@
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-transform-typescript" "^7.3.2"

"@babel/runtime-corejs2@7.4.2":
"@babel/runtime-corejs3@7.4.2":
version "7.4.2"
resolved "https://registry.yarnpkg.com/@babel/runtime-corejs2/-/runtime-corejs2-7.4.2.tgz#a0cec2c41717fa415e9c204f32b603d88b1796c2"
integrity sha512-y/Br/9uQnumcqcakkmobFqOTzYCWSS6Kuy1b2o7LTXR4lpeU0AhaOcPqIHW85LCxRWUDW5Vg0pU1KlE3YkORlg==
resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.4.2.tgz#d951565aa21cc698abbd9866d54d536814e1c4d9"
integrity sha512-KhRhNFTBO4bxwH/X21qder3+IhvIp4Bz2qMV9exQUG60q1maoEq2ucKzRqsmMfZ0LnAOoYLE4NhLztKIiYUiJg==
dependencies:
core-js "^2.6.5"
core-js-pure "^3.0.0"
regenerator-runtime "^0.13.2"

"@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.2.2", "@babel/template@^7.4.0":
Expand Down Expand Up @@ -1624,7 +1614,7 @@ core-js-compat@^3.0.0:
core-js-pure "3.0.0"
semver "^5.6.0"

core-js-pure@3.0.0:
core-js-pure@3.0.0, core-js-pure@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.0.0.tgz#a5679adb4875427c8c0488afc93e6f5b7125859b"
integrity sha512-yPiS3fQd842RZDgo/TAKGgS0f3p2nxssF1H65DIZvZv0Od5CygP8puHXn3IQiM/39VAvgCbdaMQpresrbGgt9g==
Expand All @@ -1634,11 +1624,6 @@ core-js@3.0.0:
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.0.0.tgz#a8dbfa978d29bfc263bfb66c556d0ca924c28957"
integrity sha512-WBmxlgH2122EzEJ6GH8o9L/FeoUKxxxZ6q6VUxoTlsE4EvbTWKJb447eyVxTEuq0LpXjlq/kCB2qgBvsYRkLvQ==

core-js@^2.6.5:
version "2.6.5"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.5.tgz#44bc8d249e7fb2ff5d00e0341a7ffb94fbf67895"
integrity sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A==

core-util-is@1.0.2, core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
Expand Down Expand Up @@ -4085,7 +4070,7 @@ regenerate@^1.4.0:
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11"
integrity sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==

regenerator-runtime@^0.13.2:
regenerator-runtime@0.13.2, regenerator-runtime@^0.13.2:
version "0.13.2"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz#32e59c9a6fb9b1a4aff09b4930ca2d4477343447"
integrity sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA==
Expand Down

0 comments on commit 62298c1

Please sign in to comment.