Files
clash-verge-rev/vite.config.mts
T
UddooandTunglies 4b87634da9 fix(macos): restore Big Sur home rendering without Array.at (#8358)
* fix(macos): restore Big Sur home rendering without Array.at

Include the Array.prototype.at polyfill for the declared Safari 14 target so delay and traffic rendering can read their latest records.

Fixes clash-verge-rev/clash-verge-rev#8333

AI assistance: Codex generated the change and ran validation; the implementation model identifier and effort are not exposed. Independent review used GPT-6.1-Sol at medium effort.

* build(web): auto-detect modern polyfills instead of a manual list

modernPolyfills: true lets @vitejs/plugin-legacy derive the polyfill
set from the emitted bundle, dependencies included, so post-Safari-14
API coverage no longer depends on remembering to extend the list
(#8333, and the dependency-side gaps behind #1126 and #6582).

---------

Co-authored-by: Tunglies <77394545+Tunglies@users.noreply.github.com>
2026-10-29 08:04:33 +00:00

44 lines
1.1 KiB
TypeScript

import path from 'node:path'
import legacy from '@vitejs/plugin-legacy'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import svgr from 'vite-plugin-svgr'
export default defineConfig({
root: 'src',
server: { port: 3000 },
plugins: [
svgr(),
react(),
legacy({
modernTargets: ['edge>=109', 'safari>=14'],
renderLegacyChunks: false,
// Auto-detected from the emitted bundle, dependencies included,
// so post-Safari-14 APIs never depend on extending a manual list.
modernPolyfills: true,
additionalModernPolyfills: [
path.resolve('./src/polyfills/matchMedia.js'),
path.resolve('./src/polyfills/WeakRef.js'),
path.resolve('./src/polyfills/RegExp.js'),
],
}),
],
build: {
outDir: '../dist',
emptyOutDir: true,
chunkSizeWarningLimit: 4000,
},
resolve: {
alias: {
'@': path.resolve('./src'),
'@root': path.resolve('.'),
'monaco-editor/esm/vs/editor/editor.worker.js':
'monaco-editor/editor/editor.worker',
},
},
define: {
OS_PLATFORM: `"${process.platform}"`,
},
})