Browse Source

feat: remove vitejs/plugin-legacy

main
xingyuv 2 years ago
parent
commit
01935d4692
  1. 3
      .env.production
  2. 3
      .env.test
  3. 1
      .vscode/settings.json
  4. 6
      build/vite/plugin/index.ts
  5. 1
      package.json
  6. 27
      pnpm-lock.yaml
  7. 1
      src/types/global.d.ts
  8. 2
      stylelint.config.js

3
.env.production

@ -24,6 +24,3 @@ VITE_GLOB_API_URL_PREFIX =
# 打包是否开启pwa功能
VITE_USE_PWA = false
# 是否兼容旧版浏览器。开启后打包时间会慢一倍左右。会多打出旧浏览器兼容包,且会根据浏览器兼容性自动使用相应的版本
VITE_LEGACY = false

3
.env.test

@ -26,6 +26,3 @@ VITE_GLOB_API_URL_PREFIX =
# 打包是否开启pwa功能
VITE_USE_PWA = false
# 是否兼容旧版浏览器。开启后打包时间会慢一倍左右。会多打出旧浏览器兼容包,且会根据浏览器兼容性自动使用相应的版本
VITE_LEGACY = false

1
.vscode/settings.json vendored

@ -132,7 +132,6 @@
"zxcvbn",
"lintstagedrc",
"brotli",
"tailwindcss",
"sider",
"pnpm",
"antd"

6
build/vite/plugin/index.ts

@ -2,7 +2,6 @@ import { PluginOption } from 'vite'
import vue from '@vitejs/plugin-vue'
import Unocss from 'unocss/vite'
import vueJsx from '@vitejs/plugin-vue-jsx'
import legacy from '@vitejs/plugin-legacy'
import progress from 'vite-plugin-progress'
import purgeIcons from 'vite-plugin-purge-icons'
import VitePluginCertificate from 'vite-plugin-mkcert'
@ -17,7 +16,7 @@ import { configSvgIconsPlugin } from './svgSprite'
import { isProdFn } from '../../utils'
export function createVitePlugins(mode: string, viteEnv: ViteEnv, isBuild: boolean) {
const { VITE_LEGACY, VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE } = viteEnv
const { VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE } = viteEnv
const vitePlugins: (PluginOption | PluginOption[])[] = [
// have to
@ -36,9 +35,6 @@ export function createVitePlugins(mode: string, viteEnv: ViteEnv, isBuild: boole
// Unocss
vitePlugins.push(Unocss())
// @vitejs/plugin-legacy
VITE_LEGACY && isBuild && vitePlugins.push(legacy())
// vite-vue-plugin-html
vitePlugins.push(configHtmlPlugin(viteEnv, isBuild))

1
package.json

@ -83,7 +83,6 @@
"@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/parser": "^5.56.0",
"@unocss/transformer-directives": "^0.50.6",
"@vitejs/plugin-legacy": "^4.0.2",
"@vitejs/plugin-vue": "^4.1.0",
"@vitejs/plugin-vue-jsx": "^3.0.1",
"@vue/compiler-sfc": "^3.2.47",

27
pnpm-lock.yaml

@ -22,7 +22,6 @@ specifiers:
'@typescript-eslint/eslint-plugin': ^5.56.0
'@typescript-eslint/parser': ^5.56.0
'@unocss/transformer-directives': ^0.50.6
'@vitejs/plugin-legacy': ^4.0.2
'@vitejs/plugin-vue': ^4.1.0
'@vitejs/plugin-vue-jsx': ^3.0.1
'@vue/compiler-sfc': ^3.2.47
@ -152,7 +151,6 @@ devDependencies:
'@typescript-eslint/eslint-plugin': 5.56.0_2hcjazgfnbtq42tcc73br2vup4
'@typescript-eslint/parser': 5.56.0_j4766f7ecgqbon3u7zlxn5zszu
'@unocss/transformer-directives': 0.50.6
'@vitejs/plugin-legacy': 4.0.2_terser@5.16.8+vite@4.2.1
'@vitejs/plugin-vue': 4.1.0_vite@4.2.1+vue@3.2.47
'@vitejs/plugin-vue-jsx': 3.0.1_vite@4.2.1+vue@3.2.47
'@vue/compiler-sfc': 3.2.47
@ -2995,26 +2993,6 @@ packages:
- rollup
dev: true
/@vitejs/plugin-legacy/4.0.2_terser@5.16.8+vite@4.2.1:
resolution: {integrity: sha512-ivnt9sCkgwJTYTWLjuvY6H/HTuiQC1EgzAPkiAvi0yNAssiqOJjyjhG3hAK5LFUUorE0w9kGxn8K0f/74DlbxQ==}
engines: {node: ^14.18.0 || >=16.0.0}
peerDependencies:
terser: ^5.4.0
vite: ^4.0.0
dependencies:
'@babel/core': 7.21.0
'@babel/preset-env': 7.20.2_@babel+core@7.21.0
browserslist: 4.21.5
core-js: 3.29.1
magic-string: 0.30.0
regenerator-runtime: 0.13.11
systemjs: 6.14.0
terser: 5.16.8
vite: 4.2.1_qrgdxfszmr3nib6z5ws3ht5idy
transitivePeerDependencies:
- supports-color
dev: true
/@vitejs/plugin-vue-jsx/3.0.1_vite@4.2.1+vue@3.2.47:
resolution: {integrity: sha512-+Jb7ggL48FSPS1uhPnJbJwWa9Sr90vQ+d0InW+AhBM22n+cfuYqJZDckBc+W3QSHe1WDvewMZfa4wZOtk5pRgw==}
engines: {node: ^14.18.0 || >=16.0.0}
@ -4193,6 +4171,7 @@ packages:
/core-js/3.29.1:
resolution: {integrity: sha512-+jwgnhg6cQxKYIIjGtAHq2nwUOolo9eoFZ4sHfUH09BLXBgxnH4gA0zEd+t+BO2cNB8idaBtZFcFTRjQJRJmAw==}
requiresBuild: true
dev: false
/core-util-is/1.0.3:
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
@ -8452,10 +8431,6 @@ packages:
stable: 0.1.8
dev: true
/systemjs/6.14.0:
resolution: {integrity: sha512-OMf+kFCYG9fLQerUyw/QVIPfZ+lo579R+usrDzSrZAkvMl6B0tHtc4rUP7DFaPCr7Sy6p5DYD4V9OCF1Sp6+vA==}
dev: true
/table/6.8.1:
resolution: {integrity: sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==}
engines: {node: '>=10.0.0'}

1
src/types/global.d.ts vendored

@ -60,7 +60,6 @@ declare global {
VITE_DROP_CONSOLE: boolean
VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none'
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean
VITE_LEGACY: boolean
VITE_GENERATE_UI: string
}

2
stylelint.config.js

@ -21,7 +21,7 @@ module.exports = {
'at-rule-no-unknown': [
true,
{
ignoreAtRules: ['tailwind', 'apply', 'variants', 'responsive', 'screen', 'function', 'if', 'each', 'include', 'mixin']
ignoreAtRules: ['unocss', 'apply', 'variants', 'responsive', 'screen', 'function', 'if', 'each', 'include', 'mixin']
}
],
'no-empty-source': null,