From 01935d4692de35a8c8fc5834a33d240f8c4627b8 Mon Sep 17 00:00:00 2001 From: xingyuv Date: Mon, 27 Mar 2023 16:56:57 +0800 Subject: [PATCH] feat: remove vitejs/plugin-legacy --- .env.production | 3 --- .env.test | 3 --- .vscode/settings.json | 1 - build/vite/plugin/index.ts | 6 +----- package.json | 1 - pnpm-lock.yaml | 27 +-------------------------- src/types/global.d.ts | 1 - stylelint.config.js | 2 +- 8 files changed, 3 insertions(+), 41 deletions(-) diff --git a/.env.production b/.env.production index 3931f01..704af92 100644 --- a/.env.production +++ b/.env.production @@ -24,6 +24,3 @@ VITE_GLOB_API_URL_PREFIX = # 打包是否开启pwa功能 VITE_USE_PWA = false - -# 是否兼容旧版浏览器。开启后打包时间会慢一倍左右。会多打出旧浏览器兼容包,且会根据浏览器兼容性自动使用相应的版本 -VITE_LEGACY = false diff --git a/.env.test b/.env.test index 4ed47d3..23f0d53 100644 --- a/.env.test +++ b/.env.test @@ -26,6 +26,3 @@ VITE_GLOB_API_URL_PREFIX = # 打包是否开启pwa功能 VITE_USE_PWA = false - -# 是否兼容旧版浏览器。开启后打包时间会慢一倍左右。会多打出旧浏览器兼容包,且会根据浏览器兼容性自动使用相应的版本 -VITE_LEGACY = false diff --git a/.vscode/settings.json b/.vscode/settings.json index 17374a9..84a707b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -132,7 +132,6 @@ "zxcvbn", "lintstagedrc", "brotli", - "tailwindcss", "sider", "pnpm", "antd" diff --git a/build/vite/plugin/index.ts b/build/vite/plugin/index.ts index 7e736bf..313348c 100644 --- a/build/vite/plugin/index.ts +++ b/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)) diff --git a/package.json b/package.json index 91685d7..f34a8a4 100644 --- a/package.json +++ b/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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c32e953..80aa5fb 100644 --- a/pnpm-lock.yaml +++ b/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'} diff --git a/src/types/global.d.ts b/src/types/global.d.ts index 6e3a5c5..60853ad 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -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 } diff --git a/stylelint.config.js b/stylelint.config.js index 9a254fe..af31aaf 100644 --- a/stylelint.config.js +++ b/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,