Better code splitting

pull/1/head
Antonio De Lucreziis 2 years ago
parent 717c2125c1
commit 70efa458a3

@ -13,14 +13,8 @@
href="https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,600;1,400;1,600&family=Lato:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=DM+Mono&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined"
rel="stylesheet"
/>
<link href="https://fonts.googleapis.com/css2?family=DM+Mono&display=swap" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined" rel="stylesheet" />
<link rel="stylesheet" href="/node_modules/katex/dist/katex.css" />
<link rel="stylesheet" href="/client/styles/main.scss" />

@ -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()],
})

Loading…
Cancel
Save