|
|
@@ -2,6 +2,7 @@ import path from 'path'
|
|
|
import { defineConfig } from 'vite'
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
import vueJsx from '@vitejs/plugin-vue-jsx'
|
|
|
+// import legacy from '@vitejs/plugin-legacy'
|
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
|
import Components from 'unplugin-vue-components/vite'
|
|
|
import Icons from 'unplugin-icons/vite'
|
|
|
@@ -18,8 +19,8 @@ export default ({ mode, command }) => {
|
|
|
build: {
|
|
|
outDir: 'foreground',
|
|
|
sourcemap: false,
|
|
|
- minify: true,
|
|
|
emptyOutDir: true,
|
|
|
+ chunkSizeWarningLimit: 1024,
|
|
|
rollupOptions: {
|
|
|
output: {
|
|
|
chunkFileNames: 'js/[hash].js',
|
|
|
@@ -32,10 +33,19 @@ export default ({ mode, command }) => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+ minify: 'terser' // 必须使用 terser 才能支持 legacy 插件的混淆
|
|
|
},
|
|
|
plugins: [
|
|
|
vue(),
|
|
|
+ // legacy({
|
|
|
+ // targets: ['> 0.2%', 'not dead'],
|
|
|
+ // polyfills: ['es.promise.finally', 'es/map', 'es/set'],
|
|
|
+ // // 自动引入必要的 polyfill
|
|
|
+ // additionalLegacyPolyfills: ['regenerator-runtime/runtime'],
|
|
|
+ // // 如果使用了特殊的 ES 语法,可以在这里强制 polyfill
|
|
|
+ // modernPolyfills: true
|
|
|
+ // }),
|
|
|
vueJsx(),
|
|
|
// basicSsl(),
|
|
|
Unocss({}),
|