@tailwindcss/vite@alpha
Vite error if using [&_div]:flex
and url()
with encoded content in plugins
#14809
Labels
@tailwindcss/vite@alpha
Vite error if using [&_div]:flex
and url()
with encoded content in plugins
#14809
What version of Tailwind CSS are you using?
@tailwindcss/vite
4.0.0-alpha.30
What build tool (or framework if it abstracts the build tool) are you using?
vite 5, svelte 5
What version of Node.js are you using?
v22.10.0
What operating system are you using?
For example: macOS
Reproduction URL
https://github.com/saadeghi/tw4alpha-vite-url-bug
it's an empty Vite/Svelte project.
There's
[&_div]:flex
class insrc/routes/+page.svelte
There's a Tailwind plugin in
src/myplugin.js
Describe your issue
✅ Having a Tailwind plugin like this works as expected
✅ An arbitrary class name like
[&_div]:flex
works as expected.❌ But having both in the same project using
@tailwindcss/[email protected]
causes Vite error:✅ This wasn't an issue in Tailwind CSS 3
✅ The issue doesn't happen with
@tailwindcss/[email protected]
It was really hard to debug for me because Vite just says
Unknown word
. No more details. After days I found that arbitrary class names with[]
and&
cause the issue if there's a plugin includingurl()
with encoded image in it.The text was updated successfully, but these errors were encountered: