Skip to content

Unable to use history mode in Capacitor because process.env.VUE_ROUTER_MODE is not set to 'history' in Android Capacitor mode. #18116

@46319943

Description

@46319943

What happened?

After setting vueRouterMode: 'history' in quasar.config, the SPA runs correctly in history mode. However, in Android Capacitor mode, the URL still falls back to hash mode.

While debugging with the Android WebView plugin in VS Code, I found that process.env.VUE_ROUTER_MODE is not set to history in Capacitor mode. As a result, the router defaults to createWebHashHistory in the defineRouter function inside router/index.ts.

What did you expect to happen?

process.env.VUE_ROUTER_MODE should be set to history as configured in quasar.config, so that the router uses history mode in Capacitor as well.

Reproduction URL

Note: The issue only occurs in Capacitor mode.

How to reproduce?

  1. Set vueRouterMode: 'history' in quasar.config.
  2. Run the app in Capacitor mode.
  3. Use the remote debugger.
  4. Observe that process.env.VUE_ROUTER_MODE is set to hash instead of history.

Flavour

Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)

Areas

Capacitor Mode

Platforms/Browsers

Android

Quasar info output

Relevant log output

Additional context

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