-
-
Notifications
You must be signed in to change notification settings - Fork 10.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
Improve config change handling #12319
base: dev
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: df8d61c The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
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 |
!dirname.startsWith(appDirectory) && | ||
// Ensure we're only watching files outside of the app directory | ||
// that are at the root level, not nested in subdirectories | ||
path !== root && // Watch the root directory itself | ||
dirname !== root // Watch files at the root level |
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.
Ideally, we could watch the root for only changes to <root>/react-router.config.ts
(and its module graph) and the corresponding app directory, rather than coarse-grained allowlist for any file in the root. But that's not a blocker.
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.
Actually, I think this would be relatively easy to do with Vite Node's .devserver.watcher.on
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.
Looks like we've since disabled the watcher
for the Vite Node context. But my point still stands: its better to watch for changes in the app directory and the React Router config directly, rather than watching the root and ignoring paths.
We'd need to take care to add any files that are part of the module graph for the React Router config to the watched files and then clean them up as needed. So there is a bit of complexity to get this working.
229e181
to
df8d61c
Compare
Note, this is some minor polish that can go out after the initial v7.0.0 release.
This makes the following improvements to
react-router.config.ts
change handling while the dev server / typegen watch is running:react-router.config.ts
is created or deleted.appDirectory
and updates the file watcher, unwatching the old directory and watching the new one.