-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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] Tailwind does not update classes after saving in NextJS #4081
Comments
See #4073 Same issue. |
Creating a |
I can confirm having this bug in NextJS intermittently with no way to tell if it's going to occur or not. (Apparently unrelated to #4073). It does occur (without any visible error) if I include a Tailwind plugin that is missing or PostCSS configuration file that is invalid. But it also occurs for no apparent reason, and with no obvious output that's different. JIT not working -- no JIT message, webpack warning: JIT working -- JIT message, no webpack warning: These are the same project with
The error will come & go while working in Next.js -- seems to be working fine, then suddenly JIT fails without any visible output. Restarting the Here's the list of everything I tried, but nothing seemed to make a difference:
I think @danon is on the right track with there being some type of a race condition (see #4073). Nice job with that research! 👍 Environment: |
Interesting, thanks for the tip!
For me, it also works normally with webpack 4, i.e. turning off the webpack
5 option in next.config.js
…On Sun, May 2, 2021, 10:38 AM Ivan Reshetnikov ***@***.***> wrote:
In my case, the problem is temporarily solved by changing the file
tailwind.config.js after starting the project.
[image: tailwind-trigger]
<https://user-images.githubusercontent.com/17311456/116818714-67724f00-ab75-11eb-8e63-595c3c2845a3.png>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#4081 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFZ3D2VONYMFNNGQXJOFYTTLVWXXANCNFSM427P472A>
.
|
Dropping in to also comment how JIT will intermittently stop working when using NextJS. Just started a new project today, Tailwind with JIT was working flawlessly, then all of a sudden my new css classes weren't being applied. Restarting the dev server and restarting VSCode did not fix the problem either EDIT: I can also confirm that changing text in |
Same here! 🤚 (Next 10.2 with Webpack 5) Seems only occur with Webpack 5 for me. |
Same problem here (Next 10.1.3 and Next 10.2). The problem occurs with both Webpack 4 and 5 for me and none of the above suggestions like the watch mode environment variables have helped. |
Had to do this to make JIT work:
|
Maybe watch mode should be enabled if |
Reverting to webpack 4 improves but doesn't fix the reliability issue for
me. I haven't tried the edit config file when it stops working suggestion.
Guillaume, could you elaborate? You're using webpack serve instead of next
dev?
|
I was having the same issue of JIT not updating the CSS classes with barebone webpack 5. |
I've also had this happen to me seemingly randomly in my Nextjs project (Webpack5 and I believe Webpack 4 as well). Saving changes just won't update CSS. For instance, I applied w-32 and h-32, and started changing those values and was real confused why it wasn't working. I disabled JIT, everything started working, then re-enabled JIT and it was fine. |
I had the same issue, yesterday and today. And my way to fix it was:
✨ And it works ✨ |
Just cloned down the reproduction — to get it working I needed to add Going to close as resolved but if anyone else is having issues feel free to open new issues with your own reproduction. Eventually we will make all this TAILWIND_MODE stuff less clunky — unfortunately really no easy way to detect if the user is running a watch process or just doing a one-off build though so I suspect it will always require some kind of configuration if we can't depend on NODE_ENV. |
Maybe it would be a |
And then it can print out a warning message like
|
In a lot of development environments |
I still have this problem once or twice a day. But my config is mega simple, I have nothing changed, it is out-of-the-box with nextjs. But yeah, from time to time I just have to comment the line |
@eddsaura Same here. Putting on the development mode flags didn't seem to
make much difference. But typically changing tailwind.config.js will work.
And it is a pretty rare thing still.
|
@adamwathan Hi Adam, can you please keep this issue (re)opened? A few of us are still having this issue, including me. For reference, I'm developing on a Windows 10 machine and using both a .env.development file with
as well as running $env:NODE_ENV="development"
$env:TAILWIND_MODE="watch" in PowerShell before I start up the development server with But even with the above configuration, this issue will still intermittently happen at random, requiring me to switch off jit mode, re-run |
Hey! If it's an issue for you still the best thing to do is open a new issue with your own reproduction and we can figure it out there. We generally aren't notified of activity on closed issues. |
@Akryum Great suggestion on the console stuff, I've added a message that shows any time we're running in a watch mode with a link to the docs explaining it 👍🏻 |
Same issue still occasionally occurs here. (Latest versions of Next+Tailwind, no special configuration) To fix it I didn't even had to restart the development server. Changing a single character (e.g. in a comment) in tailwind.config.js makes jit work again. The problem is that I cannot reproduce the issue on purpose. It just unpredictably happens sometimes... |
@adamwathan it is exactly as @simonedelmann says, it is unpredictably, it doesn't seem to have a trigger. Thank you! |
I've played with different tailwind projects now, just to see if the issue occurs. I took two projects, a big one and a fresh next.js instance, populated with a few components from TailwindUI. Then I tried different combinations of restarting dev server, restarting the browser, clearing browser cache, deleting .next folder and other random things, just to see if I can reproduce that issue. It happened twice in the big project and never in the small one that jit entirely stopped working. Jit just didn't change the generated css anymore then. (Jit didn't add any new classes and also jit didn't remove unused classes.) What is interesting: When jit gets stuck, restarting After changing tailwind.config.js I did exactly the same steps I did before (as far as I can tell) and it didn't happen again. I've also unsuccessfully tried if loading |
I manage to fix it with the following steps
|
@aswinmohanme I believe the consensus has been that that was required as a workaround to make sure tailwindcss is processing correctly again, but I think we should open a new issue collectively to look into a real fix, because the workaround doesn't fix the root of the problem. |
yes, lets do it, I am not too experienced to open a good issue, also because idk how to explain the error, I didn't get the reason yet. |
This seems to be an issue with webpack 5. I reverted to v4 in next.config.js and it works flawlessly so far. future: {
webpack5: false,
}, |
Had this issue until an Significant changes in the lock file: "tailwindcss": {
- "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-2.1.2.tgz",
+ "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-2.2.0.tgz", and - "@fullhuman/postcss-purgecss": "^3.1.3",
+ "@fullhuman/postcss-purgecss": "^4.0.3", |
@amithm7 Guess that means it was fixed in tailwindcss 2.2.0+, since your semantic versioning is set to |
I updated but still having issues. I have to reset de dev server a lot. For example know I had to reset it 3 times commenting the jit mode line. It is not adding the classes. |
I am still experiencing this issue on the latest |
Please open a new issue with a new reproduction, there's no easy way for us to keep track of closed issues. |
What version of Tailwind CSS are you using?
2.1
What build tool (or framework if it abstracts the build tool) are you using?
What version of Node.js are you using?
v14.15.1
What browser are you using?
chrome
What operating system are you using?
macOS for M1
Reproduction repository
https://github.com/mwarger/next-tailwind-jit-repro
Describe your issue
I've also put reproduction instructions in the repro repo.
It seems that changes made while in
jit
mode are not being picked up. As it stands now, withjit
mode enabled, only initial styles are applied, and kept. Any changes or additions result in loss of styles. Please advise. Thanks!The text was updated successfully, but these errors were encountered: