mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-14 21:20:48 +08:00
feat: add babel-plugin-react-compiler and configure Vite for optimized chunking
This commit is contained in:
+32
-1
@@ -10,7 +10,11 @@ export default defineConfig({
|
||||
server: { port: 3000 },
|
||||
plugins: [
|
||||
svgr(),
|
||||
react(),
|
||||
react({
|
||||
babel: {
|
||||
plugins: ['babel-plugin-react-compiler'],
|
||||
},
|
||||
} as any),
|
||||
legacy({
|
||||
modernTargets: ['edge>=109', 'safari>=14'],
|
||||
renderLegacyChunks: false,
|
||||
@@ -26,6 +30,24 @@ export default defineConfig({
|
||||
outDir: '../dist',
|
||||
emptyOutDir: true,
|
||||
chunkSizeWarningLimit: 4000,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: (id) => {
|
||||
if (id.includes('monaco-yaml')) return 'monaco-yaml'
|
||||
if (
|
||||
id.includes('node_modules/react/') ||
|
||||
id.includes('node_modules/react-dom/')
|
||||
)
|
||||
return 'react'
|
||||
if (id.includes('node_modules/react-router')) return 'router'
|
||||
if (
|
||||
id.includes('node_modules/i18next') ||
|
||||
id.includes('node_modules/react-i18next')
|
||||
)
|
||||
return 'i18n'
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
@@ -36,4 +58,13 @@ export default defineConfig({
|
||||
define: {
|
||||
OS_PLATFORM: `"${process.platform}"`,
|
||||
},
|
||||
optimizeDeps: {
|
||||
include: [
|
||||
'react',
|
||||
'react-dom',
|
||||
'react-router-dom',
|
||||
'i18next',
|
||||
'react-i18next',
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user