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

Closed
Spreizu opened this issue Aug 28, 2024 · 1 comment · Fixed by #3133
Assignees
Labels
layers 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage v8 v9

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: pnpm@9.8.0
  • 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

@BobbieGoede
Copy link
Collaborator

Sorry for the late response I hope the patch is working fine still. I have just opened a PR with your suggested fix (#3133), which will probably be included it in the next patch release (likely within a week).

@BobbieGoede BobbieGoede added v8 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage layers v9 and removed pending triage labels Sep 24, 2024
@BobbieGoede BobbieGoede self-assigned this Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
layers 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage v8 v9
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants