From eaee82649eac376684124733b047867eadb546ab Mon Sep 17 00:00:00 2001 From: xxx Date: Thu, 21 Sep 2023 10:32:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=AE=89=E5=8D=93=E9=92=89?= =?UTF-8?q?=E9=92=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 ++ vite.config.ts | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 2d56ee7..5edb50f 100644 --- a/package.json +++ b/package.json @@ -28,9 +28,11 @@ "devDependencies": { "@types/react": "^18.0.28", "@types/react-dom": "^18.0.11", + "@vitejs/plugin-legacy": "^4.1.1", "@vitejs/plugin-react-swc": "^3.0.0", "rollup-plugin-gzip": "^3.1.0", "sass": "^1.59.3", + "terser": "^5.20.0", "typescript": "^4.9.3", "vite": "^4.2.0" } diff --git a/vite.config.ts b/vite.config.ts index 940a1f6..0e35dd1 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,6 +1,7 @@ import { defineConfig } from "vite"; import react from "@vitejs/plugin-react-swc"; import gzipPlugin from "rollup-plugin-gzip"; +import legacy from "@vitejs/plugin-legacy"; // https://vitejs.dev/config/ export default defineConfig({ @@ -8,7 +9,15 @@ export default defineConfig({ host: "0.0.0.0", port: 9797, }, - plugins: [react()], + plugins: [ + react(), + legacy({ + targets: ["chrome 52"], + additionalLegacyPolyfills: ["regenerator-runtime/runtime"], + renderLegacyChunks: true, + modernPolyfills: true, + }), + ], build: { rollupOptions: { plugins: [gzipPlugin()],