-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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 typegen watcher leak on dev restart #12331
Conversation
🦋 Changeset detectedLatest commit: c0a4a6e The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 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 |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
If the dev server is restarted (e.g. when Vite config changes) the old file watcher is still hanging around, with the following showing up in the terminal:
MaxListenersExceededWarning: Possible EventEmitter memory leak detected.
I've confirmed that when restarting the dev server, Vite calls the
buildEnd
hook, so to fix this we need to ensure the typegen watcher is cleaned up at the same time.Note that this is a minimal fix that aims to maintain the current architecture as much as possible, but I think it'd be worth following up with making the typegen code accept a
ConfigLoader
so that it can be shared with the Vite plugin rather than having two instances of it.