mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 04:50:36 +03:00
Another attempt at chunking
This commit is contained in:
parent
d9fbb57fc6
commit
bfb88c5cd7
|
@ -6,5 +6,5 @@
|
|||
"moduleResolution": "bundler",
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
"include": ["vite.config.ts", "package.json"]
|
||||
}
|
||||
|
|
|
@ -1,10 +1,33 @@
|
|||
import react from '@vitejs/plugin-react';
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
import { dependencies } from './package.json'
|
||||
|
||||
const exclVendors = ['react', 'react-router-dom', 'react-dom']
|
||||
function renderChunks(deps: Record<string, string>) {
|
||||
const chunks = {}
|
||||
Object.keys(deps).forEach((key) => {
|
||||
if (exclVendors.includes(key)) return
|
||||
chunks[key] = [key]
|
||||
})
|
||||
return chunks
|
||||
}
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
server: {
|
||||
port: 3000
|
||||
},
|
||||
build: {
|
||||
chunkSizeWarningLimit: 4000, // KB
|
||||
sourcemap: false,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
...renderChunks(dependencies),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user