-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
feat(pluginContainer): implement watchChange hook #14822
Conversation
Run & review this pull request in StackBlitz Codeflow. |
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.
Makes sense to me. Looks like there's some linting issues that should be fixed by running pnpm format
at root.
We talked about this in the meeting today and are fine merging it 👍 It would be interesting to know if you have any usecase for using |
For future reference, this PR may break plugins that assume that |
Thanks for taking this on @patak-dev + @bluwy! I'm heads down landing our Vite switchover so I wasn't able to tweak the tests/formatting. |
Description
This PR implements the watchChange plugin hook.
Additional context
Currently, observing file changes can only be done via
server.watcher.on("change", ...)
, or somewhat lossily via thehandleHotUpdate()
plugin hook (operates on Modules rather than Files though, and doesn't run for deletions).Since the Plugin TS definition and container implementation indicate
watchChange()
hook is available (it doesn't throw likeemitFile
), I figured it would make sense to add support for it.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).