opti: 更小的前端打包体积
This commit is contained in:
@@ -18,8 +18,10 @@
|
|||||||
"@types/react": "npm:@types/react@18.3.1",
|
"@types/react": "npm:@types/react@18.3.1",
|
||||||
"@types/react-dom": "npm:@types/react-dom@18.3.1",
|
"@types/react-dom": "npm:@types/react-dom@18.3.1",
|
||||||
"@vitejs/plugin-react": "npm:@vitejs/plugin-react@4.7.0",
|
"@vitejs/plugin-react": "npm:@vitejs/plugin-react@4.7.0",
|
||||||
|
"lightningcss": "npm:lightningcss@^1.30.2",
|
||||||
"react": "npm:react@18.3.1",
|
"react": "npm:react@18.3.1",
|
||||||
"react-dom": "npm:react-dom@18.3.1",
|
"react-dom": "npm:react-dom@18.3.1",
|
||||||
|
"terser": "npm:terser@^5.44.1",
|
||||||
"vite": "npm:vite@7.0.6",
|
"vite": "npm:vite@7.0.6",
|
||||||
|
|
||||||
"rollup": "npm:@rollup/wasm-node@4.48.0",
|
"rollup": "npm:@rollup/wasm-node@4.48.0",
|
||||||
|
|||||||
@@ -9,5 +9,35 @@ export default defineConfig({
|
|||||||
build: {
|
build: {
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
outDir: "." + config.data_path + '/page_compiled',
|
outDir: "." + config.data_path + '/page_compiled',
|
||||||
|
minify: 'terser',
|
||||||
|
cssMinify: 'lightningcss',
|
||||||
|
terserOptions:{
|
||||||
|
compress:{
|
||||||
|
drop_console:true,
|
||||||
|
drop_debugger:true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
manualChunks(id) {
|
||||||
|
if (id.includes('node_modules')) {
|
||||||
|
if (id.includes('mdui')) {
|
||||||
|
return 'mdui'
|
||||||
|
}
|
||||||
|
if (id.includes('crypto-js')) {
|
||||||
|
return 'cryptojs'
|
||||||
|
}
|
||||||
|
if (id.includes('split.js')) {
|
||||||
|
return 'splitjs'
|
||||||
|
}
|
||||||
|
if (id.includes('marked')) {
|
||||||
|
return 'marked'
|
||||||
|
}
|
||||||
|
return 'vendor'
|
||||||
|
}
|
||||||
|
return 'main'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user