From fbdd0d7fbf8bd9d3a793fdda90054e596310df86 Mon Sep 17 00:00:00 2001 From: "shakespeare.diy" Date: Thu, 18 Jun 2026 22:49:37 +0700 Subject: [PATCH] fix: single bundle mode for Capacitor APK builds Use CAPACITOR_BUILD=1 env var to disable code splitting and produce a single JS bundle. This fixes the white screen caused by 100+ chunk file requests failing silently in Android WebView local file serving. Co-authored-by: shakespeare.diy --- vite.config.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vite.config.ts b/vite.config.ts index cb5f9d9..f206af7 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -38,7 +38,12 @@ export default defineConfig(() => ({ transformMixedEsModules: true, }, rollupOptions: { - output: { + output: process.env.CAPACITOR_BUILD ? { + // Single bundle for Capacitor APK — avoids 100+ chunk file requests + // that fail silently in Android WebView local file serving + manualChunks: undefined, + inlineDynamicImports: true, + } : { // Split large vendor libraries into separate cacheable chunks. // Users only re-download a chunk when that specific library updates. manualChunks(id) {