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(nuxt): allow changing dirs within modules #23133

Merged
merged 1 commit into from
Sep 12, 2023
Merged

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

resolves #15686

❓ 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)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This allows changing the dir options by respecting nuxt.options.dir when used in the root/base layer.

πŸ“ Checklist

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

@stackblitz
Copy link

stackblitz bot commented Sep 11, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

Nice fixes! I think as later improvement refactors we might:

  • Mark top level layer explicitly when loading config
  • Have kit util like getDir and possibly an ENUM for the defaults to avoid possible issues in different places.

@@ -190,9 +190,10 @@ async function initNuxt (nuxt: Nuxt) {

// Automatically register user modules
for (const config of nuxt.options._layers.map(layer => layer.config).reverse()) {
const modulesDir = (config.rootDir === nuxt.options.rootDir ? nuxt.options : config).dir?.modules || 'modules'
Copy link
Member

Choose a reason for hiding this comment

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

Note: We shall find a better way to mark top level layer (in resolver maybe) to avoid rootDir === rootDir checks

Copy link
Member Author

Choose a reason for hiding this comment

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

that would be great πŸ‘

@danielroe danielroe merged commit 9892d5c into main Sep 12, 2023
25 checks passed
@danielroe danielroe deleted the fix/mutable-dirs branch September 12, 2023 14:27
@github-actions github-actions bot mentioned this pull request Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

changing the nuxt "dir" option through a module doesn't work
2 participants