-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Restart on lock file changes #12086
base: next
Are you sure you want to change the base?
Restart on lock file changes #12086
Conversation
🦋 Changeset detectedLatest commit: 48d3e4e The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
doesn't contain a minor
I think there was a conversation about this during the offsite, but I don't quite recall 😅 What is the reason for this again? Restarting the dev server if the lockfile changes doesn't always bring the desired behaviour. For example:
It'll work for client-only libraries though I believe, but I don't think the same would happen for node/ssr. The better way in this case is to completely manually restart the dev server. |
If we can't make it work, maybe we could at least output a message like "Lockfile changes detected, restart your dev server to see changes" or something similar? It'd be cool if it actually worked, though. |
It could sometimes work though, like adding a new dependency that wasn't cached before, and after a server restart you can start using the dependency. I think Matthew fixed it in Vite to allow this flow to happen. But it's hard to tell usually which case is happening and whether it's safe. I guess there's the point where we already watch the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @bluwy here. I am not sure what we're fixing because the description of the PR doesn't say anything about it. Regardless, I would encourage users to restart the server to avoid possible side-effects
watchFiles.push(fileURLToPath(new URL('./package.json', pathToFileURL(cwd)))); | ||
// We don't official support Bun, Yarn Berry, and Yarn 1 should not be used by anyone. | ||
// Ok to add other obscure package managers. | ||
const packageFiles = ['package.json', 'package-lock.json', 'pnpm-lock.yaml']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package.json
isn't a lock file, is it a mistake?
Good points, I think what we should actually be doing here is restarting the process, not just restarting the container, because of the cached import issue. To do this I think we'll need to make it so that there's a parent process that can handle the restart. |
As a stop gap now, I'm fine with merging this to help with some cases. I was thinking it's worth mentioning that this doesn't fix all the issues with adding/updating packages. |
I think that should be easily doable by forking on the installable |
Refactoring to parent-child process to handle complete restarts feel a bit over board to me and potentially a can of worms. I think it's fine to keep the current flow as you're not editing the package.json or lock files all the time. |
Changes
Testing
Docs
N/A