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.

PostCSS/Tailwind JIT not recompiling correctly in watch mode

See original GitHub issue

Describe the bug

We use tailwindcss/postcss as part of our svelte-preprocess config (sveltePreprocess({ postcss: true })), and with esbuild-svelte, if we add new tailwind classes (ie. not appearing in our existing code), watch triggers an incremental build but tailwindcss doesn’t seem to be re-running…or if it is, it’s not noticing the new classes.

The issue is fixed by restarting the esbuild-svelte process (the first build always runs tailwind correctly), so it’s not very severe as there is an easy workaround.

To Reproduce Steps to reproduce the behavior:

  1. Start using a new tailwindcss class in a .svelte file (eg. invisible)
  2. Hit save
  3. Wait for incremental build to finish and refresh the browser

Expected behavior New tailwind class works (eg. the element disappears due to the invisible class)

Environment (please complete the following information):

  • esbuild-svelte version: esbuild-svelte@0.6.0
  • esbuild version: esbuild@0.13.13
  • Svelte preprocessors used (if any): svelte-preprocess@4.9.8, with postcss: true

Additional context

Maybe there’s something simple I’m missing? I know this might not be an esbuild-svelte issue, but I’m sure others will eventually run into the same problem. I’m happy to post more of the config if that’ll help, or even a small repro. I just wanted to hear your thoughts first before spending time on that (in case there’s something obvious).

Thanks again for your work on this project!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
EMH333commented, Jan 20, 2022

Ah that’s an interesting metric! I’ll look at adding a filter to the caching logic (for both true and "overzealous", though one will block and the other will allow caching… that’ll be fun) at some point in the future, but leave it at this for now

2reactions
tyler-boydcommented, Jan 20, 2022

Thanks, it works! Definitely wise to keep it behind an option, as running tailwind is fairly expensive (the build time with cache: "overzealous" is about halfway between true and false)

Read more comments on GitHub >

github_iconTop Results From Across the Web

JIT doesn't seem to be watching and recompiling files ... - GitHub
It appears local webpack-dev-server builds are not recompiling the TailwindCSS at all, I make a change to a component, webpack will watch and ......
Read more >
Just-in-Time Mode - Tailwind CSS
Tailwind CSS v2.1 introduces a new just-in-time compiler for Tailwind CSS that generates your styles on-demand as you author your templates instead of ......
Read more >
Tailwindcss nextjs JIT mode compile error - Stack Overflow
I solved it, for anyone who has the same problem. first i had to uninstall @tailwindcss/jit dependency, as it is included in tailwind...
Read more >
Master Tailwind CSS With Its Just-in-Time (JIT) Mode - Kinsta
Learn all the ins and outs of Tailwind CSS JIT mode, which is its Just-In-Time compilation feature. It's sure to speed up your...
Read more >
New Tailwind CSS JIT compiler - help - Meteor forums
Hey guys, I just tried with Tailwind 2.2 and it seem working properly! Just add mode: 'jit' in tailwind config and do not...
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