web: use API as dedicated module
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
@ -16,17 +16,26 @@ const resources = [
|
||||
{ src: "./icons/*", dest: "dist/assets/icons" },
|
||||
];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
function manualChunks(id) {
|
||||
if (id.includes("node_modules")) {
|
||||
return "vendor";
|
||||
}
|
||||
if (id.includes("src/api/")) {
|
||||
return "api";
|
||||
}
|
||||
}
|
||||
|
||||
export default [
|
||||
// Autogenerated API Client
|
||||
{
|
||||
input: "./api/src/index.ts",
|
||||
output: [
|
||||
{
|
||||
format: "es",
|
||||
dir: "./api/dist/",
|
||||
sourcemap: true,
|
||||
},
|
||||
],
|
||||
plugins: [
|
||||
typescript(),
|
||||
process.env.NODE_ENV === "production" ? terser() : undefined,
|
||||
].filter(p => p),
|
||||
watch: {
|
||||
clearScreen: false,
|
||||
},
|
||||
},
|
||||
// Main Application
|
||||
{
|
||||
input: "./src/main.ts",
|
||||
output: [
|
||||
@ -34,29 +43,29 @@ export default [
|
||||
format: "es",
|
||||
dir: "dist",
|
||||
sourcemap: true,
|
||||
manualChunks: manualChunks,
|
||||
},
|
||||
],
|
||||
plugins: [
|
||||
cssimport(),
|
||||
typescript(),
|
||||
externalGlobals({
|
||||
django: "django"
|
||||
django: "django",
|
||||
}),
|
||||
resolve({ browser: true }),
|
||||
commonjs(),
|
||||
sourcemaps(),
|
||||
terser(),
|
||||
process.env.NODE_ENV === "production" ? terser() : undefined,
|
||||
copy({
|
||||
targets: [...resources],
|
||||
copyOnce: false,
|
||||
}),
|
||||
],
|
||||
].filter(p => p),
|
||||
watch: {
|
||||
clearScreen: false,
|
||||
},
|
||||
external: ["django"]
|
||||
},
|
||||
// Flow executor
|
||||
{
|
||||
input: "./src/flow.ts",
|
||||
output: [
|
||||
@ -64,7 +73,6 @@ export default [
|
||||
format: "es",
|
||||
dir: "dist",
|
||||
sourcemap: true,
|
||||
manualChunks: manualChunks,
|
||||
},
|
||||
],
|
||||
plugins: [
|
||||
@ -76,12 +84,12 @@ export default [
|
||||
resolve({ browser: true }),
|
||||
commonjs(),
|
||||
sourcemaps(),
|
||||
terser(),
|
||||
process.env.NODE_ENV === "production" ? terser() : undefined,
|
||||
copy({
|
||||
targets: [...resources],
|
||||
copyOnce: false,
|
||||
}),
|
||||
],
|
||||
].filter(p => p),
|
||||
watch: {
|
||||
clearScreen: false,
|
||||
},
|
||||
|
Reference in New Issue
Block a user