-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
What version of Tailwind CSS are you using?
v4.x (current main of your fork)
What build tool (or framework if it abstracts the build tool) are you using?
Vite 6.1.0
What version of Node.js are you using?
v20.x
What browser are you using?
N/A (build-time/watch issue)
What operating system are you using?
macOS
Describe your issue
The Vite plugin intends to ignore SVG files that contain a ? or # in the path because Vite crashes when scanning those. The current regex only matches when ? or # appear before “.svg” and the string ends with “.svg”, so common paths like icons/foo.svg?component or icons/foo.svg#sprite are not ignored and can crash Vite.
Steps to reproduce:
Create a Vite project and enable the Tailwind Vite plugin from this repo.
Import an SVG with a query or hash, e.g. import Icon from './icons/foo.svg?component'.
Start dev server and modify the SVG; Vite may crash due to scanning.
Expected:
Files ending in .svg, optionally followed by ?… or #…, should be ignored by addWatchFile to avoid the known Vite crash.
Actual:
Paths like foo.svg?component or foo.svg#sprite are not matched by the ignore check and remain watched.