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(nuxi): restart nuxt when distDir is unlinked #19131

Merged
merged 4 commits into from
Feb 20, 2023

Conversation

huang-julien
Copy link
Member

πŸ”— Linked issue

resolve #15069

❓ 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

Hi πŸ‘‹
this adds a watcher on .nuxt/dist. The dev server would reload nuxt by itself if the dist directory has been removed.
This would avoid to manually restart the server.

Use case:

  • Start dev server
  • "Oh i forgot to add another package"
  • npm install another-package in another terminal
  • postinstall is run with nuxi prepare, clear buildDir
  • dev server break 😒 -- dev server restart πŸ‘
  • ctrl + C, ⬆️ , enter, wait for server to restart --- nuxt ready

πŸ“ Checklist

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

@codesandbox
Copy link

codesandbox bot commented Feb 17, 2023

CodeSandbox logoCodeSandbox logoΒ  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

What a great idea!

packages/nuxi/src/commands/dev.ts Outdated Show resolved Hide resolved
Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

This is a very nice fix.

@danielroe danielroe changed the title feat(nuxi): restart nuxt when .nuxt/dist is unlinked fix(nuxi): restart nuxt when distDir is unlinked Feb 17, 2023
@danielroe danielroe requested a review from pi0 February 17, 2023 22:34
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.

Good idea! We might extend/change it later to other dirs such as .cache since we not always remove top level dist

@danielroe danielroe merged commit eaeb4f0 into nuxt:main Feb 20, 2023
@danielroe danielroe mentioned this pull request Feb 27, 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.

cannot find client.manifest.mjs when adding or removing package while dev server is up
3 participants