Better code splitting
This commit is contained in:
+16
-2
@@ -1,4 +1,4 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import { defineConfig, splitVendorChunkPlugin } from 'vite'
|
||||
|
||||
import dotenv from 'dotenv'
|
||||
import preact from '@preact/preset-vite'
|
||||
@@ -9,5 +9,19 @@ console.log(`[Config] BASE_URL = "${process.env.BASE_URL}"`)
|
||||
|
||||
export default defineConfig({
|
||||
base: process.env.BASE_URL,
|
||||
plugins: [preact()],
|
||||
build: {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks(id) {
|
||||
if (id.includes('katex')) {
|
||||
return 'katex'
|
||||
}
|
||||
if (id.includes('unified') || id.includes('remark') || id.includes('rehype')) {
|
||||
return 'markdown'
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [splitVendorChunkPlugin(), preact()],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user