I’ve been suffering from excessive output from the Tailwind JIT / PostCSS plugin in Vite projects for the longest time. My Vite HMR logs used to look something like this in most projects:
VITE v4.3.9 ready in 852 ms
➜ Local: http://localhost:3000/ ➜ Network: http://172.19.0.4:3000/ ➜ Network: http://172.18.0.4:3000/ ➜ press h to show help
Source path: /code/front/src/assets/spa.postcssSetting up new context...Finding changed files: 43.014msReading changed files: 158.599msSorting candidates: 10.828msGenerate rules: 177.281msBuild stylesheet: 4.749msPotential classes: 11788Active contexts: 1JIT TOTAL: 829.947ms
Source path: /code/front/src/pages/Homepage.vue?vue&type=style&index=0&lang.cssJIT TOTAL: 0.844ms
[.. repeat x times for all source files]..and each HMR reload triggers a ton of Tailwind cruft in the console which makes reading the more important information pretty hard.
Turns out, this was an undocumented “feature” and kind of a configuration issue. After spending once again more time on this to find a fix, I found the code that actually outputs the JIT data. This data only gets printed If the DEBUG environment variable is truthy. It happens that often my Python projects set this variable and it leaks to the front as well. Duh!
Universal fix is easy: set the DEBUG explicitly with the dev command in package.json;
{ "scripts": { "dev": "DEBUG=0 vite" }}