From 22f5d6cacbc6ba07c64273614ded837185af01ec Mon Sep 17 00:00:00 2001 From: Steve Repsher Date: Thu, 20 Apr 2023 04:59:08 -0400 Subject: [PATCH] Migrate Babel loose options to assumptions (#16245) --- build-scripts/bundle.cjs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/build-scripts/bundle.cjs b/build-scripts/bundle.cjs index a5077badad..393fbce92c 100644 --- a/build-scripts/bundle.cjs +++ b/build-scripts/bundle.cjs @@ -84,6 +84,12 @@ module.exports.terserOptions = ({ latestBuild, isTestBuild }) => ({ module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({ babelrc: false, compact: false, + assumptions: { + privateFieldsAsProperties: true, + setPublicClassFields: true, + setSpreadProperties: true, + }, + presets: [ !latestBuild && [ "@babel/preset-env", @@ -109,7 +115,7 @@ module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({ // Part of ES2018. Converts {...a, b: 2} to Object.assign({}, a, {b: 2}) !latestBuild && [ "@babel/plugin-proposal-object-rest-spread", - { loose: true, useBuiltIns: true }, + { useBuiltIns: true }, ], // Only support the syntax, Webpack will handle it. "@babel/plugin-syntax-import-meta", @@ -119,9 +125,9 @@ module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({ "@babel/plugin-proposal-optional-chaining", "@babel/plugin-proposal-nullish-coalescing-operator", ["@babel/plugin-proposal-decorators", { decoratorsBeforeExport: true }], - ["@babel/plugin-proposal-private-methods", { loose: true }], - ["@babel/plugin-proposal-private-property-in-object", { loose: true }], - ["@babel/plugin-proposal-class-properties", { loose: true }], + "@babel/plugin-proposal-private-methods", + "@babel/plugin-proposal-private-property-in-object", + "@babel/plugin-proposal-class-properties", // Minify template literals for production isProdBuild && [ "template-html-minifier",