Skip to main content

Live Reload and Fast Iteration

Fast iteration is key to debugging both the web portion of an app and native functionality on device hardware or simulators. Unlike Capacitor, Napacitor currently has no live reload mode that "points the WebView at an external dev server" (there is no server.url config); the MAUI host always loads the build output from wwwroot/. The iteration loop on the native side is therefore rebuild → sync → run again:

npm run build # rebuild the web assets
npx nap sync # copy into the host wwwroot/ and update plugin references
npx nap run --target android # or windows / ios / maccatalyst

If running on a device, make sure it is on the same Wi-Fi network as your computer (only relevant when debugging via a dev server; local build output needs no network).

Web-side Development: Use Your Framework's Dev Server​

Fast iteration on the web portion does not depend on the native host. Any framework dev server with hot module replacement (HMR) will do:

npm run dev # dev server for Vite / webpack / angular, etc.

Once the web code has been developed and debugged in the browser, run the "build → sync → run" loop above to verify it on the native host.

Tips for Faster Native-side Iteration​

  • When only web code changes: no need to recompile C# — after npm run build && npx nap sync, just run the app again (npx nap run --target <platform> redeploys);
  • On Windows, build first, then run: npx nap build --target windows, then npx nap run --target windows;
  • When plugin or host C# code changes: a full rebuild of the host is required (npx nap build --target <platform>).

Be careful not to commit any temporary debug configuration to source control.