[JIT]: JIT not working properly. like flex classes (next js)
What version of Tailwind CSS are you using?
v2.1.1
What build tool (or framework if it abstracts the build tool) are you using?
next.js 10.1.3
What version of Node.js are you using?
v14.15.1
What browser are you using?
Firefox, Chrome
What operating system are you using?
macOS
Reproduction repository
https://github.com/MuttakinHasib/tealeaf
Describe your issue
JIT not working properly... when i use classs like w-20 or flex classes its not working properly @adamwathan can you check my repo ? is it bug or i missed something ?
Hi, could this possibly be addressed in release v2.1.2?
https://github.com/tailwindlabs/tailwindcss/releases/tag/v2.1.2
Hey! Cloned and I can't reproduce any issues here, flex classes work as does w-20:
Going to close but if this is still an issue please create a new issue with very specific steps to follow to see the issues you are seeing.
With "tailwindcss": "^2.1.2" and the tailwind.config.js that looks like this:
module.exports = {
mode: 'jit',
future: {
removeDeprecatedGapUtilities: true,
purgeLayersByDefault: true,
},
purge: [
'./public/**/*.html',
'./components/**/*.{js,ts,jsx,tsx}',
'./pages/**/*.{js,ts,jsx,tsx}',
],
variants: {},
}
...and running "dev": "next dev -p 8081"...
I experience the exact same issue as @MuttakinHasib.
<section className="px-12 mt-10 flex flex-col" style={{ minHeight: 410 }}>
<ul className="mt-5 flex flex-1">
<li className="w-24">
</li>
</ul>
</section>
- [x]
px-12works - [x]
mt-10works - [ ]
px-10doesn't work (not shown here, but observed when changing classname) - [ ]
my-10doesn't either (not shown here, but observed when changing classname) - [x]
flexworks - [ ]
flex-coldoesn't work - [x]
mt-5works - [x]
flex-1works - [ ]
w-24doesn't work
It seems sorta consistent. Restarting the server doesn't resolve the issues.
Workaround is to run rm .next/cache -rf, and then restart the server. Then it works. This makes me assume that the cause isn't necessarily in JIT, but in how JIT output is picked up by next.js (or not picked up) or how the cache is breaking it.
I'm also facing the exact same issue
With
"tailwindcss": "^2.1.2"and thetailwind.config.jsthat looks like this:module.exports = { mode: 'jit', future: { removeDeprecatedGapUtilities: true, purgeLayersByDefault: true, }, purge: [ './public/**/*.html', './components/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}', ], variants: {}, }...and running
"dev": "next dev -p 8081"...I experience the exact same issue as @MuttakinHasib.
<section className="px-12 mt-10 flex flex-col" style={{ minHeight: 410 }}> <ul className="mt-5 flex flex-1"> <li className="w-24"> </li> </ul> </section>
- [x]
px-12works- [x]
mt-10works- [ ]
px-10doesn't work (not shown here, but observed when changing classname)- [ ]
my-10doesn't either (not shown here, but observed when changing classname)- [x]
flexworks- [ ]
flex-coldoesn't work- [x]
mt-5works- [x]
flex-1works- [ ]
w-24doesn't workIt seems sorta consistent. Restarting the server doesn't resolve the issues.
Workaround is to run
rm .next/cache -rf, and then restart the server. Then it works. This makes me assume that the cause isn't necessarily in JIT, but in how JIT output is picked up by next (or not picked up) or how the cache is breaking it.
Hey, your workaround did the fix
Im consistently experiencing the same issue, unconsistently. A restart after clearing the /.next cache always resolves it. I dont know why, maybe it is an Nextjs issue,
@aludvigsen yeah... same here @adamwathan
Please open a new issue with a reproduction ❤️
I can't give you a consistent reproduction, so I won't open a new issue for the same problem that @MuttakinHasib reported and was closed because 'it couldn't be reproduced'. You'll just close that issue again with a "can't reproduce", and that would make sense :).
My mentioned workaround works consistently, but that should further indicate that this is a valid issue.
If someone does find a way to consistently reproduce this, that would be very helpful for everyone.
Same issue here! I also notice it sometimes at my production builds when styles changes won't apply.
Hope it gets fixed soon.
Can you folks try setting TAILWIND_DISABLE_TOUCH=true on the command line before starting your dev server? It'll use a different dependency tracking system that should be more resilient to how the persistent file cache in Webpack 5 works.
It would still be better if someone could create a minimal reproduction just so I know how it's all set up and can think through the possible reasons this problem could occur. It doesn't need to demonstrate the issue immediately, it's fine if the reproduction steps are "edit templates in the project for an hour and notice that eventually certain changes stop being picked up but it's different every time". It would just be helpful to see what version of webpack, what version of Next, how the purge paths are configured, what flags are being passed to Tailwind through environment variables, etc.
I also noticed the same issue when working with Next.js -e with-tailwindcss which set tailwind's mode as "jit".
After deleting the next cache, it works.
I'm running into this issue in a yarn workspace with Next.js in a subdirectory. I'm not sure you'll be able to reproduce it right after a clone but it's happening for me locally. I noticed when it wouldn't generate text-3xl and -mb-4 but it looks like a caching thing so I don't think the missing classes actually matter. Once I deleted the .next directory and restarted, jit started working again.
I know this is hardly minimal but here goes.
https://github.com/Zertz/react-headless-tabs
- Run
yarnin the root cd docsyarn dev- 🤞
I’m also experiencing the same regularly on both dev and production environments. I actually am always removing the .next directory before rebuilding the project to ensure the style changes are picked up.
What I wanted to add up is that I noticed this happening mostly when changing the value of the same utility repeatedly and sometimes when using arbitrary values as well.
This is of course all theoretical, but hopefully will help a little bit 😅
cheers
Same thing happens, sadly am facing it that I have to clear the cache everytime i update a value, never happened before
with tailwind 2.1.2
I am running into the same issue, but even clearing the cache isn't fixing it
Hey @octokatherine, can you open a new issue and provide a reproduction? If we can see it not working on our own machines we can figure it out way, way faster.
Guesses:
- Make sure on absolute latest version of everything (Next 11+, Tailwind 2.2+)
- Make sure no mistakes in your
purgeconfig - Make sure not using string interpolation in your class names
If your jit mode isn't working at all, try to structure your project like the one from this article. My issue was that jit wasn't working at all, but after reorganizing the project structure by following the linked article, now it works all the time.
Im consistently experiencing the same issue, unconsistently. A restart after clearing the
/.nextcache always resolves it. I dont know why, maybe it is an Nextjs issue,
Do you know how we can clear cache in windows
Stop the server. Yes, delete .next/cache in your project folder.