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): test watch paths against all layer srcDirs #22307

Merged
merged 14 commits into from
Jul 30, 2023

Conversation

userquin
Copy link
Member

πŸ”— Linked issue

closes #22272

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 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

watch option will be matched against the file path relative to the project srcDir, this PR normalize the path received in builder:watch to be relative to project srcDir checking also against the normalized path.

πŸ“ Checklist

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

@stackblitz
Copy link

stackblitz bot commented Jul 24, 2023

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

@userquin
Copy link
Member Author

So the problem is the watch is merged when using local layers, but the merge is using the relative path from project srcDir and so any watch configured inside the layer will not be matched, you need to add the watch entries from the layer in the project watch adding the relative path (for example ../layer-1/a.ts or ./layer-2/b.ts: these 2 paths will be included as a.ts and b.ts and will never match the corresponding layer watch).

If we use the watch from the layers previous problem is solved, since the path will be relative to the layer srcDir.

@danielroe
Copy link
Member

On investigation, the change to absolute paths was a regression, now fixed in #22333. I think that means we should normalise watched paths to absolute in schema (as you're doing), and then re-normalise them to absolute and compare them against absolute path in nuxt.ts.

I think we shouldn't need to do this per layer, but directly using nuxt.options.watch because if we normalise in the schema, the layer watch paths should already be resolved in relation to the layer directory.

Would you be able to update the PR, or would you prefer me do it?

@userquin
Copy link
Member Author

Would you be able to update the PR, or would you prefer me do it?

I'll try...

@danielroe danielroe changed the title fix(nuxt): normalize watched paths to restart nuxt server fix(nuxt): test watch paths against all layer srcDirs Jul 30, 2023
@danielroe danielroe merged commit 2df9a4b into nuxt:main Jul 30, 2023
30 checks passed
@github-actions github-actions bot mentioned this pull request Jul 30, 2023
@userquin userquin deleted the fix-watch-restart branch September 2, 2023 11:30
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.

nuxt.options.watch not restarting dev server
2 participants