Skip to content

Commit 473a945

Browse files
author
zhaozhiwen
committed
perf(build): switch @babel/runtime-corejs3 to @babel/runtime
1 parent 0b22de5 commit 473a945

File tree

4 files changed

+10
-39
lines changed

4 files changed

+10
-39
lines changed

.babelrc.js

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
11
module.exports = {
2-
presets: ['@babel/typescript', '@babel/react'],
3-
plugins: ['@babel/proposal-class-properties'],
2+
presets: ['@babel/env', '@babel/typescript', '@babel/react'],
3+
plugins: ['@babel/plugin-transform-runtime', '@babel/proposal-class-properties'],
44
env: {
5-
CJS: {
6-
presets: [['@babel/env']],
7-
plugins: [
8-
[
9-
'@babel/plugin-transform-runtime',
10-
{
11-
corejs: 3,
12-
helpers: true,
13-
},
14-
],
15-
],
16-
},
17-
ESM: {
5+
esm: {
186
presets: [
197
[
208
'@babel/env',
@@ -27,8 +15,6 @@ module.exports = {
2715
[
2816
'@babel/plugin-transform-runtime',
2917
{
30-
corejs: 3,
31-
helpers: true,
3218
useESModules: true,
3319
},
3420
],

gulpfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ function compileScripts(babelEnv, destDir) {
6262
*/
6363
function compileCJS() {
6464
const { dest } = paths;
65-
return compileScripts('CJS', dest.lib);
65+
return compileScripts('cjs', dest.lib);
6666
}
6767

6868
/**
6969
* 编译esm
7070
*/
7171
function compileESM() {
7272
const { dest } = paths;
73-
return compileScripts('ESM', dest.esm);
73+
return compileScripts('esm', dest.esm);
7474
}
7575

7676
const buildScripts = gulp.series(compileCJS, compileESM);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
}
100100
},
101101
"dependencies": {
102-
"@babel/runtime-corejs3": "^7.7.7",
102+
"@babel/runtime": "^7.7.7",
103103
"prop-types": "^15.7.2"
104104
}
105105
}

yarn.lock

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -916,18 +916,10 @@
916916
core-js-pure "^3.0.0"
917917
regenerator-runtime "^0.13.2"
918918

919-
"@babel/runtime-corejs3@^7.7.7":
919+
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.2.0", "@babel/runtime@^7.3.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.7.7":
920920
version "7.7.7"
921-
resolved "https://registry.npm.taobao.org/@babel/runtime-corejs3/download/@babel/runtime-corejs3-7.7.7.tgz#78fcbd472daec13abc42678bfc319e58a62235a3"
922-
integrity sha1-ePy9Ry2uwTq8QmeL/DGeWKYiNaM=
923-
dependencies:
924-
core-js-pure "^3.0.0"
925-
regenerator-runtime "^0.13.2"
926-
927-
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.2.0", "@babel/runtime@^7.3.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6":
928-
version "7.7.7"
929-
resolved "https://registry.npm.taobao.org/@babel/runtime/download/@babel/runtime-7.7.7.tgz#194769ca8d6d7790ec23605af9ee3e42a0aa79cf"
930-
integrity sha1-GUdpyo1td5DsI2Ba+e4+QqCqec8=
921+
resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.7.7.tgz#194769ca8d6d7790ec23605af9ee3e42a0aa79cf"
922+
integrity sha512-uCnC2JEVAu8AKB5do1WRIsvrdJ0flYx/A/9f/6chdacnEZ7LmavjdsDXr5ksYBegxtuTPR5Va9/+13QF/kFkCA==
931923
dependencies:
932924
regenerator-runtime "^0.13.2"
933925

@@ -1555,14 +1547,7 @@
15551547
resolved "https://registry.npm.taobao.org/@types/unist/download/@types/unist-2.0.3.tgz#9c088679876f374eb5983f150d4787aa6fb32d7e"
15561548
integrity sha1-nAiGeYdvN061mD8VDUeHqm+zLX4=
15571549

1558-
"@types/vfile-message@*":
1559-
version "2.0.0"
1560-
resolved "https://registry.npm.taobao.org/@types/vfile-message/download/@types/vfile-message-2.0.0.tgz#690e46af0fdfc1f9faae00cd049cc888957927d5"
1561-
integrity sha1-aQ5Grw/fwfn6rgDNBJzIiJV5J9U=
1562-
dependencies:
1563-
vfile-message "*"
1564-
1565-
"@types/vfile-message@^2.0.0":
1550+
"@types/vfile-message@*", "@types/vfile-message@^2.0.0":
15661551
version "2.0.0"
15671552
resolved "https://registry.npmjs.org/@types/vfile-message/-/vfile-message-2.0.0.tgz#690e46af0fdfc1f9faae00cd049cc888957927d5"
15681553
integrity sha512-GpTIuDpb9u4zIO165fUy9+fXcULdD8HFRNli04GehoMVbeNq7D6OBnqSmg3lxZnC+UvgUhEWKxdKiwYUkGltIw==

0 commit comments

Comments
 (0)