question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] JIT doesn't build styles on cold start

See original GitHub issue

Version

@nuxtjs/tailwindcss: 4.0.1 nuxt: 2.15.3

Reproduction Link

https://github.com/eggsy/website

Steps to reproduce

  • Enable JIT mode by putting { jit: true } in nuxt.config.js > tailwindcss.
  • Start or build your app.
  • See the result (no classes are actually built, the page doesn’t include any styles).

What is Expected?

Should parse the class names and include them in the output file.

What is actually happening?

Seems like it’s not able to read class names on the initial/cold start. It works and able to parse classes on HMR (when you edit a page/component/layout) and applies styles.

I’ve actually posted this before the v4 was merged with #287 but it got merged without me getting a “proper” answer. We have also discussed this on Nuxt.js’ Discord guild (click here to jump to message) and 2 other people reported the same issue. Tried some ways but couldn’t find anything that actually fixes this issue.

Maybe it’s because I have a separate source dir, or something else. This also happened with Windi CSS and I thought it was a bug, now I started to think about this is an issue with Nuxt/PostCSS.

This is what happens at the first start:

image

This happens when I re-save (without any changes) my index.vue (grids and other classes on the page are built successfully):

image

This is what happens when I re-save (again, without any changes) my layout, default.vue:

image

And re-saving my navbar and theme switch component:

image

So, I was able to get my index page working by editing 4 different files, and it’s not even fully working as expected. It gets reset when you build your app again…

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:13
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
eggsycommented, Mar 20, 2021

It strangely started working after a yarn upgrade today, don’t know what happened.

0reactions
Neodark7commented, May 7, 2021

@RomainMazB sorry for the late answer, actually the issue seems to be gone with the 4.1.0 version of the module, using npm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] JIT doesn't build styles on cold start #298
Seems like it's not able to read class names on the initial/cold start. It works and able to parse classes on HMR (when...
Read more >
App startup time | Android Developers
App startup time ; Understand the different app startup states. Cold start; Warm start; Hot start ; Use metrics to detect and diagnose...
Read more >
Setting up a dev environment with React, Vite, and Tailwind
Vite can cold start the dev server instantly because of the following factors: Vite prebundles the app's dependencies using esbuild, built with ...
Read more >
Make Your Lawnmower Start On The First Pull Again - YouTube
Make Your Lawnmower Start On The First Pull Again - Honda Auto-choke RepairFix 99% of Lawnmower non- starting issues by replacing this simple ......
Read more >
The Tailwind CSS “JIT Mode” Bug That Only Happens in ...
The bug is an easy mistake to make, and it's sneaky to detect, too. The issue is that I'm generating dynamic strings to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found