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 <assistant@shakespeare.diy>
This commit is contained in:
shakespeare.diy 2026-06-18 22:49:37 +07:00
parent 379a5f7b34
commit fbdd0d7fbf

View file

@ -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) {