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.

[Vite] TailwindCSS 2.2 JIT no longer tracks updated Svelte files

See original GitHub issue

Since 2.2 (tailwindlabs/tailwindcss#4514) the JIT engine switches to using the “tracking” context by default instead of “watching” context, which requires support in Vite. There’s an issue about this filed at tailwindlabs/tailwindcss#4683 but I figure it’s good to track this here as well.

Current workarounds:

  • Use TAILWIND_MODE=watch env var, which is ugly and not cross-platform without cross-env, and apparently doesn’t trigger HMR
  • Start a separate tailwind process with npm-run-all
  • Downgrade tailwind to 2.1

Proper Fix: https://github.com/vitejs/vite/commit/6eaec3ab74d126310d93f8a93f8577bed1c3f474 should in theory fix this, although I can confirm that the CI failing tests on Windows is not a fluke, I can replicate it on my machine.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
maxmellencommented, Jun 19, 2021

Can confirm I’m running into this issue as well. The TAILWIND_MODE=watch trick is a lifesaver though 👍

1reaction
wiessoncommented, Jul 7, 2021

Putting

const mode = process.env.NODE_ENV;
const dev = mode === "development";
process.env.TAILWIND_MODE = dev ? "watch" : "build";

I just want to mention that with vite 2.4+, tw JIT does not properly work without the mentioned code above. (Freshly installed sveltekit example with tailwind)

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use Svelte Kit with Tailwind CSS/JIT (Just-in-time ...
In this tutorial, we'll go through the steps that will allow you to use the latest and greatest version of tailwind with SvelteKit....
Read more >
Explicit invoking of Tailwind classes completion doesn't work ...
Write fle inside class and press Ctrl+space to invoke completion explicitly => No suggestions. Delete e , press Ctrl+space => suggestions appear.
Read more >
How to set up Svelte using Vite and Tailwind CSS - Medium
Svelte is a JavaScript tool for building UI components. I will not be saying Svelte is a framework here because it is a...
Read more >
is a custom class, make sure it is defined within a `@layer ...
The error warning you've posted relates to the use of a dark: -prefixed class - a class that is applied only in "Dark...
Read more >
Vite + Vue 3 + TypeScript + Tailwind CSS Starter Template
Notes. In order to take full advance of the new script setup sugar and full TypeScript support in Vue SFC templates (like in...
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