chore: 删除 @vitejs/plugin-legacyvue3 无法通过任何工具使其支持ie

This commit is contained in:
xiaoxian521 2022-11-17 22:11:13 +08:00
parent 5c82fdcd0f
commit 2235d9d7a8
11 changed files with 248 additions and 308 deletions

View File

@ -4,9 +4,6 @@ VITE_PUBLIC_PATH = /
# 线上环境路由历史模式Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数"
VITE_ROUTER_HISTORY = "hash"
# 是否为打包后的文件提供传统浏览器兼容性支持 支持 true 不支持 false
VITE_LEGACY = false
# 是否在打包时使用cdn替换本地库 替换 true 不替换 false
VITE_CDN = false

View File

@ -7,9 +7,6 @@ VITE_PUBLIC_PATH = /
# 预发布环境路由历史模式Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数"
VITE_ROUTER_HISTORY = "hash"
# 是否为打包后的文件提供传统浏览器兼容性支持 支持 true 不支持 false
VITE_LEGACY = false
# 是否在打包时使用cdn替换本地库 替换 true 不替换 false
VITE_CDN = true

View File

@ -282,7 +282,6 @@
- Optimize the tab page to bring a better interactive experience
- Routing title supports direct writing in Chinese, which can be separated from internationalization
- Route history mode is read from env and supports base parameter
- Packaged files provide traditional browser compatibility support, configure VITE_LEGACY to true
# 2.6.0(2021-11-10)

View File

@ -282,7 +282,6 @@
- Optimize the tab page to bring a better interactive experience
- Routing title supports direct writing in Chinese, which can be separated from internationalization
- Route history mode is read from env and supports base parameter
- Packaged files provide traditional browser compatibility support, configure VITE_LEGACY to true
# 2.6.0(2021-11-10)

View File

@ -282,7 +282,6 @@
- 优化标签页,带来更好的交互体验
- 路由 title 支持直接写中文,可脱离国际化
- 路由历史模式从 env 读取并支持 base 参数
- 打包后的文件提供传统浏览器兼容性支持,配置 VITE_LEGACY 为 true
# 2.6.0(2021-11-10)

View File

@ -5,7 +5,6 @@ const warpperEnv = (envConf: Recordable): ViteEnv => {
VITE_PORT: 8848,
VITE_PUBLIC_PATH: "",
VITE_ROUTER_HISTORY: "",
VITE_LEGACY: false,
VITE_CDN: false,
VITE_COMPRESSION: "none"
};

View File

@ -3,7 +3,6 @@ import { resolve } from "path";
import vue from "@vitejs/plugin-vue";
import { viteBuildInfo } from "./info";
import svgLoader from "vite-svg-loader";
import legacy from "@vitejs/plugin-legacy";
import vueJsx from "@vitejs/plugin-vue-jsx";
import VueMacros from "unplugin-vue-macros/vite";
import { viteMockServe } from "vite-plugin-mock";
@ -16,7 +15,6 @@ import { genScssMultipleScopeVars } from "../src/layout/theme";
export function getPluginsList(
command: string,
VITE_LEGACY: boolean,
VITE_CDN: boolean,
VITE_COMPRESSION: ViteCompression
) {
@ -65,13 +63,6 @@ export function getPluginsList(
`,
logger: false
}),
// 是否为打包后的文件提供传统浏览器兼容性支持
VITE_LEGACY
? legacy({
targets: ["ie >= 11"],
additionalLegacyPolyfills: ["regenerator-runtime/runtime"]
})
: null,
// 打包分析
lifecycle === "report"
? visualizer({ open: true, brotliSize: true, filename: "report.html" })

View File

@ -107,9 +107,8 @@
"@types/qrcode": "^1.4.2",
"@types/qs": "^6.9.7",
"@types/sortablejs": "^1.13.0",
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "^5.42.1",
"@vitejs/plugin-legacy": "^2.3.1",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.43.0",
"@vitejs/plugin-vue": "^3.2.0",
"@vitejs/plugin-vue-jsx": "^2.1.1",
"@vue/eslint-config-prettier": "^7.0.0",
@ -141,10 +140,10 @@
"stylelint-config-recommended": "^9.0.0",
"stylelint-config-standard": "^29.0.0",
"stylelint-order": "^5.0.0",
"tailwindcss": "^3.2.2",
"tailwindcss": "^3.2.4",
"terser": "^5.15.1",
"typescript": "^4.8.4",
"unplugin-vue-macros": "^0.16.2",
"typescript": "^4.9.3",
"unplugin-vue-macros": "^0.16.3",
"vite": "3.1.8",
"vite-plugin-cdn-import": "^0.3.5",
"vite-plugin-compression": "^0.5.1",

514
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

1
types/global.d.ts vendored
View File

@ -87,7 +87,6 @@ declare global {
VITE_PORT: number;
VITE_PUBLIC_PATH: string;
VITE_ROUTER_HISTORY: string;
VITE_LEGACY: boolean;
VITE_CDN: boolean;
VITE_COMPRESSION: ViteCompression;
}

View File

@ -26,13 +26,8 @@ const __APP_INFO__ = {
};
export default ({ command, mode }: ConfigEnv): UserConfigExport => {
const {
VITE_CDN,
VITE_PORT,
VITE_LEGACY,
VITE_COMPRESSION,
VITE_PUBLIC_PATH
} = warpperEnv(loadEnv(mode, root));
const { VITE_CDN, VITE_PORT, VITE_COMPRESSION, VITE_PUBLIC_PATH } =
warpperEnv(loadEnv(mode, root));
return {
base: VITE_PUBLIC_PATH,
root,
@ -49,7 +44,7 @@ export default ({ command, mode }: ConfigEnv): UserConfigExport => {
// 本地跨域代理 https://cn.vitejs.dev/config/server-options.html#server-proxy
proxy: {}
},
plugins: getPluginsList(command, VITE_LEGACY, VITE_CDN, VITE_COMPRESSION),
plugins: getPluginsList(command, VITE_CDN, VITE_COMPRESSION),
optimizeDeps: {
include: ["pinia", "vue-i18n", "lodash-es", "@vueuse/core", "dayjs"],
exclude: ["@pureadmin/theme/dist/browser-utils"]