-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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(plugin-react-refresh): add include / exclude options #3916
Conversation
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 think we could follow the rollup's conversion to have include
/ exclude
pair to construct the filter, same as the vue plugin, ref:
vite/packages/plugin-vue/src/index.ts
Lines 64 to 67 in a4acc16
const filter = createFilter( | |
rawOptions.include || /\.vue$/, | |
rawOptions.exclude | |
) |
Co-authored-by: patak <[email protected]>
Co-authored-by: patak <[email protected]>
Thanks for the reviews, @patak-js and @antfu, and sorry for my silly mistakes. |
I noticed a behaviour change in this PR that might not have been intentional. I use a plugin similar to https://github.com/rollup/plugins/blob/master/packages/virtual/src/index.ts that provides virtual files for Vite. IDs need to start with It appears This could probably be fixed by stripping any |
We should probably align ourselves with rollup here. But it is strange to me that they would not even let you add these virtual files patterns to include somehow. You can't even opt in. Maybe you could send an issue to https://github.com/rollup/plugins to better understand why this is the case and fix it upstream? |
Thanks @patak-js, good call :) Before posting there, here's what I found looking through the history of the Rollup pluginutils package:
In particular, this comment seems to indicate that we're expected to remove Do you think this requires further clarification? |
Good digging, let's discuss in the PR then 👍🏼 |
Indeed I was able to get rid of Given this and the fact that I was probably the only one affected by this, maybe we don't need to fix it after all :) |
Co-authored-by: patak <[email protected]>
Description
This PR unblocks a problem in storybook-builder-vite by allowing us to specify an
exclude
filter option to the plugin which prevents it from treating story files as HMR boundaries, as discussed in #3778.I've tested this locally in my own storybook vite project, and it does what we want, allowing the change to storybook story files to propagate into storybook itself.
Additional context
I'd love to hear from anyone who is knowledgable about HMR and in particular getting vite HMR and webpack HMR to play nicely together. 🙏 But this PR is pretty straightforward and I think it could be generally useful in other situations as well, outside of storybook.
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).