Spilt chunks to optimize the loading speed (#23)
This commit is contained in:
1 parent
317391eb1f
commit
c7a028f71c
4 files changed
+140
-7
No files matched your search
+12
-1
@@ -34,6 +34,17 @@ export default defineConfig({
|
||||
}
|
||||
},
|
||||
build: {
|
||||
sourcemap: false
|
||||
sourcemap: false,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks(id) {
|
||||
if (id.includes('node_modules')) {
|
||||
const modules = ['@vue', 'highlight.js', 'element-plus', 'axios'];
|
||||
const chunk = modules.find((module) => id.includes(module));
|
||||
return chunk ? `vendor-${chunk}` : 'vendor-others';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user