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

Vite: Work around crash when .svg file contains # or ? #16957

Merged
merged 1 commit into from
Mar 5, 2025

Conversation

philipp-spiess
Copy link
Member

@philipp-spiess philipp-spiess commented Mar 5, 2025

Closes #16877

This PR works around #16877 by not registering .svg files containing a # or ? as a watch dependency for now.

Test plan

  • Add a file to the Vite playground called src/c#.svg
  • Observe Vite no longer prints errors

@philipp-spiess philipp-spiess marked this pull request as ready for review March 5, 2025 12:01
@philipp-spiess philipp-spiess requested a review from a team as a code owner March 5, 2025 12:01
Copy link
Member

@RobinMalfait RobinMalfait left a comment

Choose a reason for hiding this comment

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

That's unfortunate that Vite crashes here; Does that mean that if you have these SVGs in your project that changes are never reflected and you have to restart your build for them to take effect?

Because I think the only reason Vite is crashing due to our plugin is just because we mark it with addWatchFile?

@philipp-spiess
Copy link
Member Author

Does that mean that if you have these SVGs in your project that changes are never reflected and you have to restart your build for them to take effect?

Correct if you have .svg with # in the name right now, Vite will print a warning and not pick up any changes. This change makes it so that Vite wont print a warning and won't error in some other setups but also does not pick up any changes. We can revert this once the upstream issue is fixed: vitejs/vite#19563

@philipp-spiess philipp-spiess merged commit a8b64f3 into main Mar 5, 2025
5 checks passed
@philipp-spiess philipp-spiess deleted the fix/vite-hash-svg branch March 5, 2025 13:55
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.

[v4.0.8] Storybook + Vite crashes if filename contains #
2 participants