Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom route paths are not working with Nuxt 4 directory structure/custom srcDir inside Layers #3076

Open
Spreizu opened this issue Aug 28, 2024 · 0 comments

Comments

@Spreizu
Copy link

Spreizu commented Aug 28, 2024

Environment

  • Operating System: Darwin
  • Node Version: v20.5.1
  • Nuxt Version: 3.13.0
  • CLI Version: 3.13.0
  • Nitro Version: 2.9.7
  • Package Manager: [email protected]
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

Reproduction: https://stackblitz.com/edit/bobbiegoede-nuxt-i18n-starter-knvwuy?file=src%2Flayers%2Fcustom-layer%2Fnuxt.config.ts

Describe the bug

When using the new Nuxt 4 directory structure in Layers with customRoutes: "config" the following warning is returned and no valid routes are generated for locales: [@nuxtjs/i18n]: Couldn't find AnalyzedNuxtPageMeta by NuxtPage (/custom/:slug()), so no custom route for it .

This occurs, because the pages directory is not resolved correctly in this function:

export const mergeLayerPages = (analyzer: (pathOverride: string) => void, nuxt: Nuxt) => {

Additional context

When patching part of the function specified above from:
const lPath = resolve(project.config.rootDir, l.config.rootDir, l.config.dir?.pages ?? 'pages')
to:
const lPath = resolve(project.config.rootDir, l.config.srcDir, l.config.dir?.pages ?? 'pages')

then everything appears to work correctly.

Logs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant