Skip to content

Commit 028c8e1

Browse files
committed
docs(vue): add troubleshooting entry for blank screen in Capacitor builds
1 parent 2502b2c commit 028c8e1

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

docs/vue/troubleshooting.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,25 @@ await modal.present();
116116
```
117117

118118
This is done to align with how developers bind events in their Vue templates by using kebab-case: https://vuejs.org/guide/essentials/component-basics.html#case-insensitivity
119+
120+
## Blank white screen in Capacitor native build
121+
122+
If your app runs correctly in the browser but shows a blank white screen when launched in a Capacitor iOS or Android build, the most common cause is a non-default `base` in `vite.config.js` (or `publicPath` in `vue.config.js` for legacy Vue CLI projects).
123+
124+
This option is often added so the app can be hosted from a subdirectory, such as a GitHub Pages deploy:
125+
126+
```js
127+
// vite.config.js
128+
export default defineConfig({
129+
base: '/my-repo/',
130+
});
131+
```
132+
133+
In a Capacitor build the bundled assets are served from a local origin (`capacitor://localhost` on iOS and `https://localhost` on Android by default), so the prefixed paths never resolve and the app fails to bootstrap.
134+
135+
To fix it, reset `base` to `/` (or remove the option) before running `npx cap copy`. If you need both targets, keep a separate config file for each and select it at build time with `vite build --config`.
136+
137+
To confirm this is the cause, inspect the device log for 404s on the prefixed asset paths:
138+
139+
- **Android:** Run `adb logcat` from the command line, or open **Logcat** in Android Studio.
140+
- **iOS:** Open Safari's **Develop** menu and inspect the Simulator or device webview.

0 commit comments

Comments
 (0)