PostCSS/Tailwind JIT not recompiling correctly in watch mode
See original GitHub issueDescribe 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:
- Start using a new tailwindcss class in a .svelte file (eg.
invisible
) - Hit save
- 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:
- Created 2 years ago
- Comments:9 (9 by maintainers)
Top GitHub Comments
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 nowThanks, 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 betweentrue
andfalse
)