mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-10-23 03:27:43 +09:00
Merge vite 8 upgrade (vite 5→8 + rolldown manualChunks, @vitejs/plugin-react 4→6)
This commit is contained in:
commit
dcf05d1cc1
3 files changed
+584
-1265
No files matched your search
Generated
+567
-1257
File diff suppressed because it is too large.
Load diff
@@ -50,14 +50,14 @@
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.3.3",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@vitejs/plugin-react": "^4.3.1",
|
||||
"@vitejs/plugin-react": "^6.0.3",
|
||||
"eslint": "^9.9.0",
|
||||
"eslint-plugin-react": "^7.35.0",
|
||||
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.9",
|
||||
"globals": "^15.9.0",
|
||||
"sass": "^1.86.0",
|
||||
"vite": "^5.4.1"
|
||||
"vite": "^8.1.4"
|
||||
},
|
||||
"overrides": {
|
||||
"lodash": "4.18.1",
|
||||
|
||||
+15
-6
@@ -117,12 +117,21 @@ export default defineConfig(({ mode }) => {
|
||||
sourcemap: false,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
'vendor-react': ['react', 'react-dom', 'react-router-dom'],
|
||||
'vendor-charts': ['recharts'],
|
||||
'vendor-flow': ['@xyflow/react'],
|
||||
'vendor-xterm': ['@xterm/xterm', '@xterm/addon-fit', '@xterm/addon-web-links'],
|
||||
'vendor-icons': ['lucide-react'],
|
||||
// Vite 8 bundles with rolldown, which only accepts the
|
||||
// FUNCTION form of manualChunks (the object form that
|
||||
// Rollup allowed throws "manualChunks is not a function").
|
||||
// Match on node_modules path so each listed package — plus
|
||||
// its private deps — lands in one cohesive vendor chunk.
|
||||
// Anything unmatched falls through to Vite's default
|
||||
// chunking, so shared deps (e.g. d3 used by both charts and
|
||||
// flow) get their own common chunk instead of duplicating.
|
||||
manualChunks(id) {
|
||||
if (!id.includes('node_modules')) return
|
||||
if (/[\\/]node_modules[\\/](react|react-dom|react-router|react-router-dom|@remix-run[\\/]router|scheduler)[\\/]/.test(id)) return 'vendor-react'
|
||||
if (/[\\/]node_modules[\\/]recharts[\\/]/.test(id)) return 'vendor-charts'
|
||||
if (/[\\/]node_modules[\\/]@xyflow[\\/]/.test(id)) return 'vendor-flow'
|
||||
if (/[\\/]node_modules[\\/]@xterm[\\/]/.test(id)) return 'vendor-xterm'
|
||||
if (/[\\/]node_modules[\\/]lucide-react[\\/]/.test(id)) return 'vendor-icons'
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user