From 2eb2df6ed29efd8e6dce7aabc8d23771aac308ca Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Wed, 12 May 2021 08:11:43 +0800 Subject: [PATCH] Update babel config (#10855) --- package.json | 2 +- scripts/build/build.js | 2 +- scripts/build/bundler.js | 17 ++++++++--------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 26baabc79..d9f5c8909 100644 --- a/package.json +++ b/package.json @@ -149,7 +149,7 @@ "lint:eslint": "cross-env EFF_NO_LINK_RULES=true eslint . --format friendly", "lint:changelog": "node ./scripts/lint-changelog.js", "lint:prettier": "prettier . \"!test*\" --check", - "lint:dist": "eslint --no-eslintrc --no-ignore --no-inline-config --env=es6,browser --parser-options=ecmaVersion:2018 \"dist/!(bin-prettier|index|third-party).js\"", + "lint:dist": "eslint --no-eslintrc --no-ignore --no-inline-config --env=es6,browser --parser-options=ecmaVersion:2019 \"dist/!(bin-prettier|index|third-party).js\"", "lint:spellcheck": "cspell \"**/*\" \".github/**/*\"", "lint:deps": "node ./scripts/check-deps.js", "fix": "run-s fix:eslint fix:prettier", diff --git a/scripts/build/build.js b/scripts/build/build.js index 81591846f..a44f39797 100644 --- a/scripts/build/build.js +++ b/scripts/build/build.js @@ -22,7 +22,7 @@ process.on("unhandledRejection", (err) => { process.exit(1); }); -const CACHE_VERSION = "v33"; // This need update when updating build scripts +const CACHE_VERSION = "v34"; // This need update when updating build scripts const statusConfig = [ { color: "bgYellow", text: "CACHED" }, { color: "bgGreen", text: "DONE" }, diff --git a/scripts/build/bundler.js b/scripts/build/bundler.js index dd0a14c00..569fd7588 100644 --- a/scripts/build/bundler.js +++ b/scripts/build/bundler.js @@ -83,6 +83,9 @@ function webpackNativeShims(config, modules) { function getBabelConfig(bundle) { const config = { babelrc: false, + assumptions: { + setSpreadProperties: true, + }, sourceType: "unambiguous", plugins: bundle.babelPlugins || [], compact: bundle.type === "plugin" ? false : "auto", @@ -104,7 +107,7 @@ function getBabelConfig(bundle) { } config.presets = [ [ - require.resolve("@babel/preset-env"), + "@babel/preset-env", { targets, exclude: [ @@ -114,7 +117,6 @@ function getBabelConfig(bundle) { "es.string.replace", "es.symbol.description", "es.typed-array.*", - "transform-async-to-generator", "web.*", ], modules: false, @@ -126,13 +128,10 @@ function getBabelConfig(bundle) { }, ], ]; - config.plugins.push( - [ - require.resolve("@babel/plugin-proposal-object-rest-spread"), - { loose: true, useBuiltIns: true }, - ], - require.resolve("@babel/plugin-proposal-optional-catch-binding") - ); + config.plugins.push([ + "@babel/plugin-proposal-object-rest-spread", + { useBuiltIns: true }, + ]); return config; }