|
@@ -7,6 +7,7 @@ import Components from "unplugin-vue-components/vite";
|
|
|
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
|
|
|
import Icons from "unplugin-icons/vite";
|
|
|
import IconsResolver from "unplugin-icons/resolver";
|
|
|
+import legacyPlugin from "@vitejs/plugin-legacy";
|
|
|
|
|
|
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
|
|
|
import mockDevServerPlugin from "vite-plugin-mock-dev-server";
|
|
@@ -84,6 +85,10 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
|
|
UnoCSS({
|
|
|
hmrTopLevelAwait: false,
|
|
|
}),
|
|
|
+ legacyPlugin({
|
|
|
+ targets: ["chrome 70"], // 需要兼容的目标列表,可以设置多个
|
|
|
+ additionalLegacyPolyfills: ["regenerator-runtime/runtime"], // 面向IE11时需要此插件
|
|
|
+ }),
|
|
|
// 自动导入参考: https://github.com/sxzz/element-plus-best-practices/blob/main/vite.config.ts
|
|
|
AutoImport({
|
|
|
// 自动导入 Vue 相关函数,如:ref, reactive, toRef 等
|
|
@@ -251,6 +256,9 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
|
|
__APP_INFO__: JSON.stringify(__APP_INFO__),
|
|
|
"process.env": process.env, //尝试访问 Node.js 环境变量,但这些变量在浏览器环境中是不存在的。(process is not defined)
|
|
|
},
|
|
|
+ esbuild: {
|
|
|
+ drop: ["console", "debugger"], // 去除 console.log 和 debugger
|
|
|
+ },
|
|
|
};
|
|
|
});
|
|
|
// 打包文件时候 更新版本号 用作判断是否要刷新页面
|