diff --git a/aleksis/core/vite.config.js b/aleksis/core/vite.config.js index 2da114abc304a3d3fb3e3991bb36368b25438993..12a7bcc5baeec4f19645bc16bbfba556ace7f9f8 100644 --- a/aleksis/core/vite.config.js +++ b/aleksis/core/vite.config.js @@ -31,6 +31,28 @@ export default defineConfig({ manifest: true, rollupOptions: { input: django_values.coreEntrypoint, + output: { + manualChunks(id) { + // Split big libraries into own chunks + if (id.includes("node_modules/vue")) { + return "vue"; + } else if (id.includes("node_modules/apollo")) { + return "apollo"; + } else if (id.includes("node_modules/graphql")) { + return "graphql"; + } else if (id.includes("node_modules")) { + // Fallback for all other libraries + return "vendor"; + } + + // Split each AlekSIS app in its own chunk + for (const [appPackage, ep] of Object.entries(django_values.appEntrypoints)) { + if (id.includes(ep)) { + return appPackage; + } + } + }, + }, }, }, server: {