From 864d8195d29038f75a7b47d5ff3102c0ae360ba0 Mon Sep 17 00:00:00 2001 From: qlin Date: Tue, 23 Aug 2022 17:41:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=8E=B0=E4=BB=A3?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8=20polyfill=20=E9=97=AE=E9=A2=98=20(?= =?UTF-8?q?#147)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fes-builder-vite/package.json | 1 + .../fes-builder-vite/src/commands/build/getBuildConfig.js | 2 ++ packages/fes-template-vite/src/pages/index.vue | 5 ++++- yarn.lock | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/fes-builder-vite/package.json b/packages/fes-builder-vite/package.json index ac39470f..9473f2b6 100644 --- a/packages/fes-builder-vite/package.json +++ b/packages/fes-builder-vite/package.json @@ -37,6 +37,7 @@ "postcss-flexbugs-fixes": "^5.0.2", "postcss-safe-parser": "^6.0.0", "rollup-plugin-visualizer": "^5.6.0", + "terser": "^5.14.2", "vite": "^3.0.4", "vite-plugin-html": "^3.2.0" }, diff --git a/packages/fes-builder-vite/src/commands/build/getBuildConfig.js b/packages/fes-builder-vite/src/commands/build/getBuildConfig.js index 433b2cab..51096c0a 100644 --- a/packages/fes-builder-vite/src/commands/build/getBuildConfig.js +++ b/packages/fes-builder-vite/src/commands/build/getBuildConfig.js @@ -23,11 +23,13 @@ export default async (api) => { }, plugins: [ legacy({ + modernPolyfills: true, targets, }), ], build: { ...build, + minify: 'terser', terserOptions: build.terserOptions || api.config.terserOptions, target: build.target || 'es2015', outDir: build.outDir || api.config.outputPath || 'dist', diff --git a/packages/fes-template-vite/src/pages/index.vue b/packages/fes-template-vite/src/pages/index.vue index 298cc045..518ebf56 100644 --- a/packages/fes-template-vite/src/pages/index.vue +++ b/packages/fes-template-vite/src/pages/index.vue @@ -14,7 +14,10 @@ export default { FButton, }, setup() { - return {}; + const a = 'aa'.replaceAll('a', 1); + return { + a, + }; }, }; diff --git a/yarn.lock b/yarn.lock index 6cc5c0ed..c712c6e3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10113,7 +10113,7 @@ terser-webpack-plugin@^5.1.3: serialize-javascript "^6.0.0" terser "^5.14.1" -terser@^5.0.0, terser@^5.10.0, terser@^5.14.1: +terser@^5.0.0, terser@^5.10.0, terser@^5.14.1, terser@^5.14.2: version "5.14.2" resolved "https://registry.npmmirror.com/terser/-/terser-5.14.2.tgz#9ac9f22b06994d736174f4091aa368db896f1c10" integrity sha512-oL0rGeM/WFQCUd0y2QrWxYnq7tfSuKBiqTjRPWrRgB46WD/kiwHwF8T23z78H6Q6kGCuuHcPB+KULHRdxvVGQA==