From cff602c2462dc088ebf388da5034e3045f3176e0 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Wed, 11 Dec 2024 13:15:05 +0000 Subject: [PATCH] feat: remove @vitejs/plugin-legacy (#2921) Quote: > Vite's default browser support baseline is Native ESM, native ESM dynamic import, and import.meta. This plugin provides support for legacy browsers that do not support those features when building for production. Since all three feature now have more than 97% market share it seems fine to remove them. Reviewed-on: https://kolaente.dev/vikunja/vikunja/pulls/2921 Co-authored-by: Dominik Pschenitschni Co-committed-by: Dominik Pschenitschni --- frontend/package.json | 2 -- frontend/pnpm-lock.yaml | 53 ----------------------------------------- frontend/vite.config.ts | 12 ---------- 3 files changed, 67 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 970deffe0..46d1c3876 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -31,7 +31,6 @@ "preview:test": "vite preview --port 4173 --outDir dist-test", "build": "vite build && workbox copyLibraries dist/", "build:test": "vite build --outDir dist-test && workbox copyLibraries dist-dev/", - "build:modern-only": "BUILD_MODERN_ONLY=true vite build && workbox copyLibraries dist/", "build:dev": "vite build --mode development --outDir dist-dev/", "lint": "eslint 'src/**/*.{js,ts,vue}'", "lint:fix": "pnpm run lint --fix", @@ -140,7 +139,6 @@ "@types/sortablejs": "1.15.8", "@typescript-eslint/eslint-plugin": "8.18.0", "@typescript-eslint/parser": "8.18.0", - "@vitejs/plugin-legacy": "6.0.0", "@vitejs/plugin-vue": "5.2.1", "@vue/eslint-config-typescript": "14.1.4", "@vue/test-utils": "2.4.6", diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index 8a96a61db..84e33a7ab 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -281,9 +281,6 @@ importers: '@typescript-eslint/parser': specifier: 8.18.0 version: 8.18.0(eslint@9.16.0(jiti@1.21.6))(typescript@5.7.2) - '@vitejs/plugin-legacy': - specifier: 6.0.0 - version: 6.0.0(terser@5.31.6)(vite@6.0.3(@types/node@22.10.1)(jiti@1.21.6)(sass-embedded@1.82.0)(sass@1.80.6)(terser@5.31.6)(yaml@2.5.0)) '@vitejs/plugin-vue': specifier: 5.2.1 version: 5.2.1(vite@6.0.3(@types/node@22.10.1)(jiti@1.21.6)(sass-embedded@1.82.0)(sass@1.80.6)(terser@5.31.6)(yaml@2.5.0))(vue@3.5.13(typescript@5.7.2)) @@ -2613,13 +2610,6 @@ packages: resolution: {integrity: sha512-pCh/qEA8Lb1wVIqNvBke8UaRjJ6wrAWkJO5yyIbs8Yx6TNGYyfNjOo61tLv+WwLvoLPp4BQ8B7AHKijl8NGUfw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@vitejs/plugin-legacy@6.0.0': - resolution: {integrity: sha512-pWt9cWaGJAKYw+67VLpN8hSP+G+yAQnrf5Pqh/NzSDKFl/4KpxTtwb5OLQezHoZOxghahO/ha3IpvblBbX/t6A==} - engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} - peerDependencies: - terser: ^5.16.0 - vite: ^6.0.0 - '@vitejs/plugin-vue@5.2.1': resolution: {integrity: sha512-cxh314tzaWwOLqVes2gnnCtvBDcM1UMdn+iFR+UjAn411dPT3tOmqrJjbMd7koZpMAmBM/GqeV4n9ge7JSiJJQ==} engines: {node: ^18.0.0 || >=20.0.0} @@ -3005,13 +2995,6 @@ packages: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} - browserslist-to-esbuild@2.1.1: - resolution: {integrity: sha512-KN+mty6C3e9AN8Z5dI1xeN15ExcRNeISoC3g7V0Kax/MMF9MSoYA2G7lkTTcVUFntiEjkpI0HNgqJC1NjdyNUw==} - engines: {node: '>=18'} - hasBin: true - peerDependencies: - browserslist: '*' - browserslist@4.24.2: resolution: {integrity: sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} @@ -3251,9 +3234,6 @@ packages: core-js-compat@3.38.1: resolution: {integrity: sha512-JRH6gfXxGmrzF3tZ57lFx97YARxCXPaMzPo6jELZhv88pBH5VXpQ+y0znKGlFnzuaihqhLbefxSJxWJMPtfDzw==} - core-js@3.39.0: - resolution: {integrity: sha512-raM0ew0/jJUqkJ0E6e8UDtl+y/7ktFivgWvqw8dNSQeNWoSDLvQ1H/RN3aPXB9tBd4/FhyR4RDPGhsNIMsAn7g==} - core-util-is@1.0.2: resolution: {integrity: sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==} @@ -4689,10 +4669,6 @@ packages: mdurl@2.0.0: resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==} - meow@13.2.0: - resolution: {integrity: sha512-pxQJQzB6djGPXh08dacEloMFopsOqGVRKFPYvPOt9XDZ1HasbgDZA74CJGreSU4G3Ak7EFJGoiH2auq+yXISgA==} - engines: {node: '>=18'} - meow@7.1.1: resolution: {integrity: sha512-GWHvA5QOcS412WCo8vwKDlTelGLsCGBVevQB5Kva961rmNfun0PCbv5+xta2kUMFJyR8/oWnn7ddeKdosbAPbA==} engines: {node: '>=10'} @@ -6033,9 +6009,6 @@ packages: resolution: {integrity: sha512-GTt8rSKje5FilG+wEdfCkOcLL7LWqpMlr2c3LRuKt/YXxcJ52aGSbGBAdI4L3aaqfrBt6y711El53ItyH1NWzg==} engines: {node: '>=16.0.0'} - systemjs@6.15.1: - resolution: {integrity: sha512-Nk8c4lXvMB98MtbmjX7JwJRgJOL8fluecYCfCeYBznwmpOs8Bf15hLM6z4z71EDAhQVrQrI+wt1aLWSXZq+hXA==} - tailwindcss@3.4.16: resolution: {integrity: sha512-TI4Cyx7gDiZ6r44ewaJmt0o6BrMCT5aK5e0rmJ/G9Xq3w7CX/5VXl/zIPEJZFUK5VEqwByyhqNPycPlvcK4ZNw==} engines: {node: '>=14.0.0'} @@ -9150,21 +9123,6 @@ snapshots: '@typescript-eslint/types': 8.18.0 eslint-visitor-keys: 4.2.0 - '@vitejs/plugin-legacy@6.0.0(terser@5.31.6)(vite@6.0.3(@types/node@22.10.1)(jiti@1.21.6)(sass-embedded@1.82.0)(sass@1.80.6)(terser@5.31.6)(yaml@2.5.0))': - dependencies: - '@babel/core': 7.26.0 - '@babel/preset-env': 7.26.0(@babel/core@7.26.0) - browserslist: 4.24.2 - browserslist-to-esbuild: 2.1.1(browserslist@4.24.2) - core-js: 3.39.0 - magic-string: 0.30.14 - regenerator-runtime: 0.14.1 - systemjs: 6.15.1 - terser: 5.31.6 - vite: 6.0.3(@types/node@22.10.1)(jiti@1.21.6)(sass-embedded@1.82.0)(sass@1.80.6)(terser@5.31.6)(yaml@2.5.0) - transitivePeerDependencies: - - supports-color - '@vitejs/plugin-vue@5.2.1(vite@6.0.3(@types/node@22.10.1)(jiti@1.21.6)(sass-embedded@1.82.0)(sass@1.80.6)(terser@5.31.6)(yaml@2.5.0))(vue@3.5.13(typescript@5.7.2))': dependencies: vite: 6.0.3(@types/node@22.10.1)(jiti@1.21.6)(sass-embedded@1.82.0)(sass@1.80.6)(terser@5.31.6)(yaml@2.5.0) @@ -9656,11 +9614,6 @@ snapshots: dependencies: fill-range: 7.1.1 - browserslist-to-esbuild@2.1.1(browserslist@4.24.2): - dependencies: - browserslist: 4.24.2 - meow: 13.2.0 - browserslist@4.24.2: dependencies: caniuse-lite: 1.0.30001687 @@ -9921,8 +9874,6 @@ snapshots: dependencies: browserslist: 4.24.2 - core-js@3.39.0: {} - core-util-is@1.0.2: {} crelt@1.0.6: {} @@ -11552,8 +11503,6 @@ snapshots: mdurl@2.0.0: {} - meow@13.2.0: {} - meow@7.1.1: dependencies: '@types/minimist': 1.2.5 @@ -12982,8 +12931,6 @@ snapshots: sync-message-port@1.1.3: {} - systemjs@6.15.1: {} - tailwindcss@3.4.16: dependencies: '@alloc/quick-lru': 5.2.0 diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 6ddbe6a99..c4d955105 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -2,7 +2,6 @@ import {defineConfig, type PluginOption, loadEnv} from 'vite' import {configDefaults} from 'vitest/config' import vue from '@vitejs/plugin-vue' -import legacyFn from '@vitejs/plugin-legacy' import {URL, fileURLToPath} from 'node:url' import {dirname, resolve} from 'node:path' @@ -24,16 +23,6 @@ const pathSrc = fileURLToPath(new URL('./src', import.meta.url)).replaceAll('\\' const PREFIXED_SCSS_STYLES = `@use "sass:math"; @import "${pathSrc}/styles/common-imports.scss";` -const isModernBuild = Boolean(process.env.BUILD_MODERN_ONLY) -const legacy = isModernBuild - ? undefined - : legacyFn() - -console.log(isModernBuild - ? 'Building "modern-only" build' - : 'Building "legacy" build with "@vitejs/plugin-legacy"', -) - /* ** Configure sentry plugin */ @@ -116,7 +105,6 @@ export default defineConfig(({mode}) => { propsDestructure: true, }, }), - legacy, svgLoader({ // Since the svgs are already manually optimized via https://jakearchibald.github.io/svgomg/ // we don't need to optimize them again.