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

fix: locales not being included when srcDir has been changed #1964

Merged
merged 1 commit into from
Mar 29, 2023

Conversation

BobbieGoede
Copy link
Collaborator

πŸ”— Linked issue

#1963

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Resolves #1963

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

src/layers.ts Outdated
@@ -149,6 +149,6 @@ export const getLayerLangPaths = (nuxt: Nuxt) => {
nuxt.options._layers
.filter(layer => layer.config.i18n?.langDir != null)
// @ts-ignore
.map(layer => pathe.resolve(layer.config.rootDir, layer.config.i18n.langDir)) as string[]
.map(layer => pathe.resolve(layer.config.rootDir, layer.config.srcDir, layer.config.i18n.langDir)) as string[]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debugging this I found that layer.config.srcDir already has layer.config.rootDir included. So you should probably use:

pathe.resolve(layer.config.srcDir, layer.config.i18n.langDir)

But I'm not sure if I'm correct with this.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Messed up the copy&pase. I meant pathe.resolve(layer.config.srcDir, layer.config.i18n.langDir) and updated my previous comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, it looks like srcDir includes the absolute path, I thought it would use the configured value of srcDir. But as seen here rootDir is always part of srcDir on _layers https://github.com/nuxt/nuxt/blob/ae82d7089598bd1a4e5a8f88cd9edf7a1f12d7c7/packages/kit/src/loader/config.ts#L34

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nice catch. Thank you for checking this.

@WolfgangDrescher
Copy link

Adding srcDir could also be relevant for mergeLayerPages() and maybe also other places.

@BobbieGoede
Copy link
Collaborator Author

Adding srcDir could also be relevant for mergeLayerPages() and maybe also other places.

That's a good point! I will test a custom srcDir with custom pages dir (in project and/or layer) when I have the time.

@kazupon kazupon merged commit 7a0a570 into nuxt-modules:next Mar 29, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spaces in YAML translation files with nuxt srcDir config
3 participants