Skip to content

Commit

Permalink
fix babel bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zzcwoshizz committed Apr 12, 2023
1 parent c6fa222 commit 2d080ae
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 16 deletions.
4 changes: 2 additions & 2 deletions packages/dev/config/babel-config-cjs.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const presets = require('./babel-presets.cjs');

module.exports = {
...general,
plugins: plugins(false),
presets: presets(false)
plugins: plugins(false, false),
presets: presets(false, false)
};
4 changes: 2 additions & 2 deletions packages/dev/config/babel-config-esm.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const presets = require('./babel-presets.cjs');

module.exports = {
...general,
plugins: plugins(true),
presets: presets(true)
plugins: plugins(true, false),
presets: presets(true, false)
};
4 changes: 2 additions & 2 deletions packages/dev/config/babel-config-webpack.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const presets = require('./babel-presets.cjs');

module.exports = {
...general,
plugins: plugins(true),
presets: presets(true)
plugins: plugins(true, true),
presets: presets(true, true)
};
4 changes: 2 additions & 2 deletions packages/dev/config/babel-plugins.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

const resolver = require('./babel-resolver.cjs');

module.exports = function (isEsm) {
module.exports = function (isEsm, usage) {
return resolver([
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-numeric-separator',
'@babel/plugin-proposal-optional-chaining',
[
'@babel/plugin-transform-runtime',
{
corejs: 3,
corejs: usage ? 3 : false,
helpers: true,
regenerator: true,
useESModules: isEsm
Expand Down
6 changes: 3 additions & 3 deletions packages/dev/config/babel-presets.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

const resolver = require('./babel-resolver.cjs');

module.exports = function (isEsm) {
module.exports = function (isEsm, usage) {
return resolver([
'@babel/preset-typescript',
[
Expand All @@ -16,8 +16,8 @@ module.exports = function (isEsm) {
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 3,
useBuiltIns: usage ? 'usage' : false,
corejs: usage ? 3 : false,
exclude: [
// we don't want 2n ** 128n to Math.pow(2n, 128n)
'@babel/plugin-transform-exponentiation-operator',
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"@babel/preset-typescript": "^7.21.0",
"@babel/register": "^7.21.0",
"@babel/runtime": "^7.21.0",
"@babel/runtime-corejs3": "^7.21.0",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.0",
"@manypkg/get-packages": "^2.1.0",
Expand All @@ -70,7 +71,6 @@
"browserslist": "^4.21.5",
"conventional-changelog": "^3.1.25",
"conventional-recommended-bump": "^6.1.0",
"core-js": "^3.30.0",
"coveralls": "^3.1.1",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.7.0",
Expand Down
18 changes: 14 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1555,6 +1555,16 @@ __metadata:
languageName: node
linkType: hard

"@babel/runtime-corejs3@npm:^7.21.0":
version: 7.21.0
resolution: "@babel/runtime-corejs3@npm:7.21.0"
dependencies:
core-js-pure: "npm:^3.25.1"
regenerator-runtime: "npm:^0.13.11"
checksum: f4990101d1d03f330cac65b5cfcd98c37f46e55ebc048abcb44f39477348789d36b75b6ab216007a949b462f6fb9b15ebb2e09e6e4b8e50b31ce4840f27f383b
languageName: node
linkType: hard

"@babel/runtime@npm:^7.20.1, @babel/runtime@npm:^7.20.7, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.8.4":
version: 7.20.13
resolution: "@babel/runtime@npm:7.20.13"
Expand Down Expand Up @@ -3583,6 +3593,7 @@ __metadata:
"@babel/preset-typescript": "npm:^7.21.0"
"@babel/register": "npm:^7.21.0"
"@babel/runtime": "npm:^7.21.0"
"@babel/runtime-corejs3": "npm:^7.21.0"
"@changesets/changelog-github": "npm:^0.4.8"
"@changesets/cli": "npm:^2.26.0"
"@manypkg/get-packages": "npm:^2.1.0"
Expand All @@ -3603,7 +3614,6 @@ __metadata:
browserslist: "npm:^4.21.5"
conventional-changelog: "npm:^3.1.25"
conventional-recommended-bump: "npm:^6.1.0"
core-js: "npm:^3.30.0"
coveralls: "npm:^3.1.1"
eslint: "npm:^8.36.0"
eslint-config-prettier: "npm:^8.7.0"
Expand Down Expand Up @@ -5327,10 +5337,10 @@ __metadata:
languageName: node
linkType: hard

"core-js@npm:^3.30.0":
"core-js-pure@npm:^3.25.1":
version: 3.30.0
resolution: "core-js@npm:3.30.0"
checksum: c064eeb6f8d61059a4355081940ffa7dd0c9c00cd4dfb84b11642acd2312718afe7444bd41de89c1f5060263ec6faa50b7e9da106206afd6e085758a3be9b039
resolution: "core-js-pure@npm:3.30.0"
checksum: da1369da504a1fb52e1a75c47f2f92b38221b2d8bd3690363f0a4328946f9381af7bd31e0be80e449909ff419e012faec5122f28401789253cfa21e48e129437
languageName: node
linkType: hard

Expand Down

0 comments on commit 2d080ae

Please sign in to comment.