web: use chunking for vendor and api
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
ce555aa5e9
commit
0d9db1b6f2
|
@ -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: [
|
||||||
|
|
Reference in New Issue