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
JIT mode is not picking up changes unless I change tailwind.config.js file #4978
Comments
Not to bloat this thread but I have just the same Issue with the exact same specs. Hot reloading is working but on JIT mode changes on tailwind styling fails on document save until you modify and save |
I tried to downgrade to 2.2.0 and 2.1.4 but behaviour is the same. |
Same. Happening in my nextjs and vite projects. Tried to downgrade already but no luck. Its happening in a brand new vite project and a 1 year old nextjs project. |
It works for like 10 minutes and then stops generating classes. |
Not 100% the same issue here, but similar so I think it's worth to add. HMR stops working and the page is fully reloaded on every change (might be related: #4970 and #4968). If I disable JIT and run Setup as following. Everything on the very latest versions. Tailwind: Build tool: Node: Browser: Operating System: Backend |
FWIW, there is a vite issue with how postcss registers all purgeable files as dependencies with There is a PR incoming : |
In my case HMR does not work at all when I make modifications to JIT classes unless I stop the |
Can I ask you if you can reproduce this situation?
|
I am running into the same issue. I created a test repo from the NextJS My larger project is typescript and NextJS., NextJS - v11
|
I downgrade vite to 2.3.8,tailwind to 2.1.4,it works |
same issue here on v2.2.4 with create-react-app -> using CRACO Dev server needs to be stopped and started up again after every change. |
@pingustar try the solution from #4768 |
@MohammadxAli I think I was able to reproduce this, but the classes do get picked up if I re-save the HTML file. Can you confirm whether this is the case for you? |
@bradlc Yes that's true! I didn't realize that saving the same HTML files can also trigger picking up classes. But it's important to note that the contents of the file must be changed when re-saving, otherwise the classes won't be added. I am now using tailwindcss with |
Just to add an example from Tailwind UI, if you go to https://tailwindui.com/components/marketing/sections/heroes change the "Hero Section" title to "text-red-400" instead of text-grey-400 and the color goes blank (if you change the css class on the webpage not the code). Change it to another color and it also goes blank. Not sure if thats the intended affect. Locally i can change the code and once i refresh the page itll change the color. But if i dont refresh the page, the css will change on the html automatically but the color wont show it, which kind of breaks local development with HMR. |
I'm facing the same issue using Vite. When creating an example to reproduce the issue, I noticed that it only happens when I set the base path in Vite. I need this option to integrate with Django. I created a repo that demonstrates my observation https://github.com/Kostia-K/vite-tailwind-jit-issue |
Hey all. I too was stumped by this issue while working on a Phoenix project last night. After finding this issue, I dug around a bit, and I have a workaround for Webpack pipelines. As it turns out, Phoenix 1.5.9 uses
https://webpack.js.org/loaders/postcss-loader/ Installing |
having the same issue, on nextjs 11. |
Update: This only worked temporarily and I'm stumped. |
As @Kostia-K mentioned, problems in Vite.js seem to be related to the usage of the Related: ElMassimo/vite_ruby#115 Downgrading It seems like the problem started happening in A potential fix here: vitejs/vite#4592. |
The change in vitejs#4267 caused all CSS dependencies of files that are not CSS (Tailwind CSS JIT deps) to be tracked with the `base` prefix in the module graph. URLs in the module graph are normalized and are never prefixed with base and as a result changes to those files were not causing the CSS module to be invalidated. See tailwindlabs/tailwindcss#4978 (comment)
Same here, but slightly different scenario: with JIT mode and hot reload enabled, using a class that's not been used yet, it'll add the class to the div but Tailwind won't generate the CSS for the class. If I refresh the page, the CSS class has been added to the styles and it works. Just not when using hot reload. Tried a few variations like adding the Node env variables or changing the Tailwind config file, but nothing fixes it. Firefox Developer Edition |
I have the same problem as @sebastiaanluca but maybe it's vite + pug vitejs/vite#4588 |
@MohammadxAli I was able to reproduce in your repo but it seemed to stem from build configuration issues. I've opened a PR to your repo that fixes it by just fixing the configuration problems: MohammadxAli/tailwind-laravel-mix-starter#1 Going to close this one only because everyone here I think has slightly different issues, and the issue for the OP is resolved with that PR. It's hard to keep track of multiple problems/conversations in a single issue, so instead I would ask that you please open a new issue if you are experiencing a problem that brought you to this issue and include a minimal reproduction so we can figure out what the specific issue is for your particular situation. Happy to help, not closing to be dismissive, just need to keep things on topic and organized if we want any hope of actually helping people, thanks! |
For those of you using Laravel Mix and HMR ( Issue: #5477 |
I use webpack v5, downgrade tailwind from 3.2.7 to 2.1.4, it works. |
I know this is an old thread, but Im having troubles with this too, with Astro, the styles at some point are no longer applied, I need to comment a line of my |
What version of Tailwind CSS are you using?
v2.2.4
What build tool (or framework if it abstracts the build tool) are you using?
postcss-cli v8.3.1
What version of Node.js are you using?
v14.15.5
What browser are you using?
Firefox
What operating system are you using?
Windows
Reproduction repository
https://github.com/MohammadxAli/tailwind-test-repo
Describe your issue
Sometimes tailwind in
jit
mode is not adding classes to final CSS when I'm adding them to my HTML files unless I edit thetailwind.config.js
file, I usually comment and uncomment some line in that file and all of sudden I see the class has been added to the CSS file, I had this very same issue on my Next.js project as well.I made a new reproduction repository and tested things there, it was all good and working. Not really sure why it's not working on my own projects at some point. This may sound stupid but maybe tailwind is not picking up changes as the project get's more complicated?
I made this issue to know if anyone had some similar experience or not, so maybe someone can guide me on how to resolve this.
The text was updated successfully, but these errors were encountered: