Skip to content

[Bug]: Capacitorjs does not work with sveltekit compiled in hash routing mode on iOS - infinitely reloads webview. #7972

Closed
@jjgmckenzie

Description

@jjgmckenzie

Capacitor Version

💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 7.2.0
@capacitor/core: 7.2.0
@capacitor/android: 7.2.0
@capacitor/ios: 7.2.0

Installed Dependencies:

@capacitor/android: not installed
@capacitor/cli: 7.2.0
@capacitor/core: 7.2.0
@capacitor/ios: 7.2.0

[success] iOS looking great! 👌

Other API Details

npm version 10.9.2
node version v23.7.0
pod version 1.16.2

Platforms Affected

  • iOS
  • Android (did not test - possibly?)
  • Web (does not affect web)

Current Behavior

When loading the build from a sveltekit application in hash routing mode, the application appears to continuously reload the webview - never initializing sveltekit:

(reproduction project provided)

npm install
npx vite build
npx cap sync
npx cap open ios

xcode output: (webview loads about every second)

⚡️  Loading app at capacitor://localhost...
⚡️  WebView loaded
⚡️  WebView loaded
⚡️  WebView loaded
⚡️  WebView loaded
⚡️  WebView loaded
⚡️  WebView loaded
⚡️  WebView loaded
⚡️  WebView loaded
⚡️  WebView loaded
⚡️  WebView loaded
⚡️  WebView loaded
⚡️  WebView loaded
⚡️  WebView loaded
...

This does not occur when in server mode from vite, nor in web.

Expected Behavior

It should behave identically to when in server mode or web

Project Reproduction

https://github.com/jjgmckenzie/sveltekit-hash-routing-capacitor-app

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions