web: lazy load parts of interfaces (#2864)

This commit is contained in:
Jens L
2022-05-14 17:07:37 +02:00
committed by GitHub
parent 4da350ebfc
commit be06adcb59
18 changed files with 389 additions and 314 deletions

View File

@ -70,24 +70,32 @@ export function manualChunks(id) {
}
}
export const PLUGINS = [
cssimport(),
markdown(),
nodeResolve({ extensions, browser: true }),
commonjs(),
babel({
extensions,
babelHelpers: "runtime",
include: ["src/**/*"],
}),
replace({
"process.env.NODE_ENV": JSON.stringify(isProdBuild ? "production" : "development"),
"process.env.AK_API_BASE_PATH": JSON.stringify(apiBasePath),
"preventAssignment": true,
}),
sourcemaps(),
isProdBuild && terser(),
].filter((p) => p);
export const defaultOptions = {
plugins: [
cssimport(),
markdown(),
nodeResolve({ extensions, browser: true }),
commonjs(),
babel({
extensions,
babelHelpers: "runtime",
include: ["src/**/*"],
}),
replace({
"process.env.NODE_ENV": JSON.stringify(isProdBuild ? "production" : "development"),
"process.env.AK_API_BASE_PATH": JSON.stringify(apiBasePath),
"preventAssignment": true,
}),
sourcemaps(),
isProdBuild && terser(),
].filter((p) => p),
watch: {
clearScreen: false,
},
preserveEntrySignatures: false,
cache: true,
context: "window",
};
// Polyfills (imported first)
export const POLY = {
@ -110,9 +118,6 @@ export const POLY = {
copyOnce: false,
}),
].filter((p) => p),
watch: {
clearScreen: false,
},
};
export default [
@ -120,8 +125,6 @@ export default [
// Flow interface
{
input: "./src/interfaces/FlowInterface.ts",
context: "window",
cache: true,
output: [
{
format: "es",
@ -130,16 +133,11 @@ export default [
manualChunks: manualChunks,
},
],
plugins: PLUGINS,
watch: {
clearScreen: false,
},
...defaultOptions,
},
// Admin interface
{
input: "./src/interfaces/AdminInterface.ts",
context: "window",
cache: true,
output: [
{
format: "es",
@ -148,16 +146,11 @@ export default [
manualChunks: manualChunks,
},
],
plugins: PLUGINS,
watch: {
clearScreen: false,
},
...defaultOptions,
},
// User interface
{
input: "./src/interfaces/UserInterface.ts",
context: "window",
cache: true,
output: [
{
format: "es",
@ -166,9 +159,6 @@ export default [
manualChunks: manualChunks,
},
],
plugins: PLUGINS,
watch: {
clearScreen: false,
},
...defaultOptions,
},
];