web: use chunking for vendor and api

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-03-16 17:00:02 +01:00
parent ce555aa5e9
commit 0d9db1b6f2
1 changed files with 11 additions and 0 deletions

View File

@ -18,6 +18,15 @@ const resources = [
{ src: "./icons/*", dest: "dist/assets/icons" }, { src: "./icons/*", dest: "dist/assets/icons" },
]; ];
function manualChunks(id) {
if (id.includes('node_modules')) {
return 'vendor';
}
if (id.includes("src/api/")) {
return "api";
}
}
export default [ export default [
{ {
input: "./src/main.ts", input: "./src/main.ts",
@ -26,6 +35,7 @@ export default [
format: "es", format: "es",
dir: "dist", dir: "dist",
sourcemap: true, sourcemap: true,
manualChunks: manualChunks,
}, },
], ],
plugins: [ plugins: [
@ -55,6 +65,7 @@ export default [
format: "es", format: "es",
dir: "dist", dir: "dist",
sourcemap: true, sourcemap: true,
manualChunks: manualChunks,
}, },
], ],
plugins: [ plugins: [