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

Using @tailwindcss/vite breaks updates on imported CSS #17339

Closed
vladmoroz opened this issue Mar 23, 2025 · 3 comments · Fixed by #17347
Closed

Using @tailwindcss/vite breaks updates on imported CSS #17339

vladmoroz opened this issue Mar 23, 2025 · 3 comments · Fixed by #17347

Comments

@vladmoroz
Copy link

vladmoroz commented Mar 23, 2025

What version of Tailwind CSS are you using?

v4.0.15 (latest)

What build tool (or framework if it abstracts the build tool) are you using?

Vite 6.2.2 (latest)

Reproduction URL

https://codesandbox.io/p/devbox/x3r86q

Describe your issue

Initial setup:

  • Import Tailwind and another CSS file(s) into the root CSS file

Steps to reproduce:

  1. Edit index.html (may be a change to JS/JSX files too)
  2. Edit imported.css
  3. Outdated CSS will be served until another change to index.html or index.css is made, or until the server is restarted. Page refresh doesn't serve the latest CSS either.

CSS changes work fine without @import "tailwindcss". It also works when using @tailwindcss/postcss instead of the Vite plugin.

Might be related
#16764

@vladmoroz vladmoroz changed the title Using @tailwindcss/vite breaks CSS HMR Using @tailwindcss/vite breaks CSS serving Mar 23, 2025
@vladmoroz vladmoroz changed the title Using @tailwindcss/vite breaks CSS serving Using @tailwindcss/vite breaks imported CSS changes Mar 23, 2025
@vladmoroz vladmoroz changed the title Using @tailwindcss/vite breaks imported CSS changes Using @tailwindcss/vite breaks updates on imported CSS Mar 23, 2025
@philipp-spiess
Copy link
Member

Hey! Thanks for the bug report, was able to confirm this and merged a fix into main. Will be out with the next release 👍

@vladmoroz
Copy link
Author

Hey, appreciate a fast fix
While we are here, is there any reason to use @taildwindcss/vite over @tailwindcss/postcss?

@philipp-spiess
Copy link
Member

Hey! Good question especially since 4.0.7 made these two much closer in-line. The biggest reason is that Vite can be used without PostCSS at all (using the css.transformer option IIRC). But also we have much better control of the dependency graph with a Vite plugin so it does not require us to add lots of wildcard listeners.

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 a pull request may close this issue.

2 participants