-
-
Notifications
You must be signed in to change notification settings - Fork 516
Open
Labels
Description
Environment
- Operating System: Darwin
- Node Version: v22.21.1
- Nuxt Version: 4.2.1
- CLI Version: 3.30.0
- Nitro Version: 2.12.9
- Package Manager: [email protected]
- Builder: -
- User Config: compatibilityDate, devtools, modules, i18n, typescript, app, experimental
- Runtime Modules: @nuxtjs/[email protected]
- Build Modules: -
Reproduction
set nuxt.config.ts
app: {
baseURL: '/12345'
}
and
i18n:{
strategy: 'prefix'
}
- Open stackblitz reproduction page
- Open the page in new tab
- Reload the page.
console shows WARN [Vue Router warn]: The Matcher cannot resolve relative paths but received "345/en". Unless you directly called matcher.resolve("345/en"), this is probably a bug in vue-router. Please open an issue at https://github.com/vuejs/router/issues/new/choose.
Describe the bug
I believe the root cause of this bug is that app.baseURL (defined in nuxt.config.ts) is not taken into account when calculating the path.
i18n/src/runtime/server/plugin.ts
Line 158 in 15bb7bb
| const path = (pathLocale && url.pathname.slice(pathLocale.length + 1)) ?? url.pathname |
Proposed Fix: I suggest modifying the code as follows:
const path = (pathLocale && event.path.slice(pathLocale.length + 1)) ?? event.pathsorry, I haven't checked for potential side effects.
Additional context
No response
Logs
n-kort