From e98f76c8ee15fdd9092438ed2c6ca07e0becf05c Mon Sep 17 00:00:00 2001
From: dumbmoron <log@riseup.net>
Date: Thu, 4 Jul 2024 22:15:15 +0000
Subject: [PATCH] web/build: merge i18n chunks for each language into one file

---
 web/vite.config.ts | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/web/vite.config.ts b/web/vite.config.ts
index 4d92ae44..d6663e0d 100644
--- a/web/vite.config.ts
+++ b/web/vite.config.ts
@@ -5,6 +5,20 @@ export default defineConfig({
     plugins: [
         sveltekit()
     ],
+    build: {
+        rollupOptions: {
+            output: {
+                manualChunks: (id) => {
+                    if (id.includes('/web/i18n')) {
+                        const lang = id.split('/web/i18n/')?.[1].split('/')?.[0];
+                        if (lang) {
+                            return `i18n_${lang}`;
+                        }
+                    }
+                }
+            }
+        }
+    },
     server: {
         fs: {
             allow: [