-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Watch CSS module files for changes #17467
Conversation
We have to still track the `.css` files so we can listen for changes.
c20c92d
to
03ffa45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤞 we get no build loops lol
}, | ||
} | ||
`, | ||
'webpack.config.js': js` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to try what happens if you enable https://webpack.js.org/configuration/output/#outputclean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Luckily that didn't make a difference, but also annoying that I can't reproduce it haha. 923c98f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to mark this as "request changes" for now because in #17412 the repro also needed the emptyOutDir
vite option so it would be good to test with the clean
webpack option.
This PR is a follow-up PR for: #17433
In the other PR we allow scanning CSS files for extracting usages of CSS variables. This is important for
.module.css
files that reference these variables but aren't in the same big AST of the main CSS file.This PR also makes sure to watch for changes in those registered CSS files and re-extract the variables when they change.
This PR took a bit longer than expected because I was trying to make sure that writing to
./dist/out.css
works without infinite-looping (e.g.: we had issues with this in Tailwind CSS v3 with webpack).But I couldn't reproduce the issue at all. I did had some code that tried to detect if the CSS file contained license headers and skip in (because then it's very likely an output CSS file) but even without it the tests were fine.
I setup integration tests with
@tailwindcss/cli
itself, and with tools that use webpack. Added a test for Next.js, and a dedicated webpack test as well.Even without tests, locally, I couldn't reproduce an infinite loop due to changes in an output CSS file...
Eventually dropped the code that tries to detect output CSS files.
One thing to keep in mind is that if you change any of your "main" CSS files, then we will trigger a full rebuild anyway, so this change is only required for unrelated CSS files (like CSS module files) that use CSS variables.
Test plan