refactor: code splitting strategy

This commit is contained in:
Azgaar 2022-07-05 23:59:47 +03:00
parent 41180c57bf
commit 95baf27d58

View file

@ -24,6 +24,25 @@ export default defineConfig(({mode}) => {
}
})
],
build: {
rollupOptions: {
output: {
manualChunks(id, {getModuleInfo}) {
if (id.includes("d3")) {
return "d3";
}
if (id.includes("node_modules")) {
return "vendor";
}
const importersLen = getModuleInfo(id).importers.length;
if (importersLen > 1) {
return "common";
}
}
}
}
},
resolve: {
alias: [
{find: "src", replacement: path.resolve(pathName, "./src")},