Skip to content
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: Only run Vite plugin on J/TSX files #537

Closed
wants to merge 1 commit into from

Conversation

rschristian
Copy link
Member

Fixes vitejs/vite#15262, I think. Need to check yet. Would also need to land in preset-vite, as we form a similar regex there and pass it in to the Prefresh plugin, but thought I'd address it here first.

Now, I'm not quite sure if this breaks anything... is there any need for Prefresh to run in .js or .ts files? Custom hooks? Dunno, unfortunately I'm not super familiar with how Prefresh actually facilitates HMR.

FWIW, this was the regex pattern in use (more or less) until #42, at which point it changed to the form we have now. I don't see any obvious context to it, so it might've just been a (relatively harmless in all fairness) accidental change?

Copy link

changeset-bot bot commented Mar 22, 2024

⚠️ No Changeset found

Latest commit: 975dc97

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -19,7 +19,7 @@ module.exports = function prefreshPlugin(options = {}) {
: options && options.ssr === true;
if (
shouldSkip ||
!/\.(t|j)sx?$/.test(id) ||
!/\.(t|j)sx$/.test(id) ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit dangerous for custom-hook files as those aren't jsx but js

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was worried about that. A better check is in order then, I'll need to figure that out.

@rschristian
Copy link
Member Author

Closing, I have no plans to figure this out but hopefully the linked context is useful enough (assuming there is something for us to fix)

@rschristian rschristian deleted the fix/vite-transform branch May 28, 2024 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants