JIT mode doesn't load classes #5993
-
What version of Tailwind CSS are you using?2.2.7 What build tool (or framework if it abstracts the build tool) are you using?vite 2.4.4 What version of Node.js are you using?14.17.3 What browser are you using?N/A What operating system are you using?macOS Reproduction repositoryhttps://codesandbox.io/s/hello-vite-forked-l4tu2 Describe your issueIn JIT mode new classes styles dont update when it's new attributes in classes, using postcss If you change class and reload page there are no styling. When you'll restart process it'll load up classes. I tested it on vite with vue, and vite with vue and ruby on rails |
Beta Was this translation helpful? Give feedback.
Replies: 16 comments 1 reply
-
Hey! Can you provide an actual reproduction repo? CodeSandbox has its own quirks so it's not the best place to reproduce these types of issues. I copied your project to a local Vite project and everything is working as expected: Screen.Recording.2021-08-02.at.8.24.12.AM.mov |
Beta Was this translation helpful? Give feedback.
-
I have the same problem after upgrading to Eg: // 'yarn start' - this work fine
<div class="mx-10"></div>
// Edit the markup 'mx-10' => 'mx-20'
<div class="mx-20"></div>
// 'mx-20' css not loaded
// I have to 'yarn start' again
// Now mx-20 work
// Edit the markup again 'mx-20' => 'mx-24'
<div class="mx-24"></div>
// 'mx-24' css not loaded
// I have to 'yarn start' again
|
Beta Was this translation helpful? Give feedback.
-
@hta218 may I suggest you have a read through the troubleshooting section of the docs, particularly this section: https://tailwindcss.com/docs/just-in-time-mode#styles-don-t-update-when-saving-content-files If you're confident the problem comes from the JIT engine itself, please open an issue with a code repro. Also, please don't get frustrated with a feature that is still in preview mode 🙏 |
Beta Was this translation helpful? Give feedback.
-
Hey @simonswiss Thank you so much, Anw, I just love the framework, :D |
Beta Was this translation helpful? Give feedback.
-
I had this issue after upgrading from 2.1.4 to 2.2.7. Here is a repo: https://github.com/phoenecke/tailwind-jit-test Downgrading to 2.1.4 fixed it for me. macOS - node v14.15.3 |
Beta Was this translation helpful? Give feedback.
-
After fighting a while with that issue, I simply updated both tailwind and postcss to latest (now Amazing feature, thanks for the great job ! |
Beta Was this translation helpful? Give feedback.
-
So, it seems like the problem might be that |
Beta Was this translation helpful? Give feedback.
-
But on codesandbox it works in same way as on my machine, it does update classes but doesn't styles. Screen.Recording.2021-08-05.at.22.08.50.movSeems like |
Beta Was this translation helpful? Give feedback.
-
I confirm this issue on the same configuration (Ruby on Rails + Vite + Vue.js on macOS). I tried upgrading Tailwind CSS and PostCSS to the most recent versions as @KojoEnch did a couple of weeks ago, too, and it helped for a while, but then the issue reappeared. Today I tried to upgrade Tailwind CSS and PostCSS once again, but that didn’t help. |
Beta Was this translation helpful? Give feedback.
-
To be clear, it worked from the start but stopped working at some point for an unknown reason. |
Beta Was this translation helpful? Give feedback.
-
It's working unless you won't use class that doesn't exist in project already (aren't loaded). Like it loads on init and then stop updating list of used classes. |
Beta Was this translation helpful? Give feedback.
-
@phoenecke I was finnaly able to overcome the problem because of your help. Thank you so much!! |
Beta Was this translation helpful? Give feedback.
-
This is the issue i was having from at least 2.2.7 - 2.2.15
Downgrading to 2.1.4 also fixed for me. Thank you @phoenecke Windows 10, node v15.8.0 |
Beta Was this translation helpful? Give feedback.
-
I having the same problem |
Beta Was this translation helpful? Give feedback.
-
The main reason why downgrading to The repro provided by @phoenecke uses an old The good news is that there is an alpha version for If you are using Create React App, then here are a few solutions you can use:
|
Beta Was this translation helpful? Give feedback.
-
This is still a problem with Tailwind 3 running with Vite on Windows. Classes aren't picked up by the JIT compiler and they only show up after a full build. Setting Has anybody got suggestions on how to work around this problem? I wouldn't mind investigating for a root cause and making a proper bug report, if you can tell me where to start. |
Beta Was this translation helpful? Give feedback.
The main reason why downgrading to
2.1.4
works is because we don't haveJIT
mode in that version yet, so there you will use the old (slow)AOT
mode (even if you defined amode
in your tailwind.config.js file, because in that version it is ignored).The repro provided by @phoenecke uses an old
react-scripts
version where theTAILWIND_MODE=watch
environment variable is required. This is becausereact-scripts
currently ships withPostCSS 7
instead ofPostCSS 8
.The good news is that there is an alpha version for
react-scripts
currently at^5.0.0-next.47
. The bad news is that this version is currently not compatible with@craco/craco
.If you are using Create React App, then here are a few sol…