Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dual compilation problem in rollup-solid-tailwindcss project #4026

Closed
samadadi opened this issue Apr 9, 2021 · 2 comments
Closed

dual compilation problem in rollup-solid-tailwindcss project #4026

samadadi opened this issue Apr 9, 2021 · 2 comments

Comments

@samadadi
Copy link

samadadi commented Apr 9, 2021

What version of Tailwind CSS are you using?

v2.1.1

What version of Node.js are you using?

v14.15.1

What browser are you using?

chrome

What operating system are you using?

linux

Reproduction repository

https://github.com/samadadi/rollup-solid-tailwind-starter

Describe your issue

There are two problems:

  1. In my vscode terminal I am noticing dual compilation and compilation happens twice, especially in medium size project when compilation time increases (maybe you can't notice if it is so fast).
  2. css rules related to old/removed class names remains in output file (you can check with opening css file in the browser).

Note: With disabling jit mode everything is working fine. there is no dual compilation.
Please look in my configuration files, maybe I am doing something terribly wrong.

@samadadi
Copy link
Author

samadadi commented Apr 10, 2021

So I think dual compilation comes from the fact that both rollup bundler and tailwind are watching for files change. Since tailwind is a plugin to postcss and postcss is a plugin for rollup then I don't think It is logical to make tailwind to watch file changes since It is the bundler duty to do so. I mean in this case tailwind's job is to extract class names from changed files and transform it with information that bundler provides for postcss.

@adamwathan
Copy link
Member

Yeah so what is happening I expect is that you save a template, Rollup rebuilds, and at the same time, Tailwind is rebuilding the CSS, and when the CSS is rebuilt, Rollup sees the updated CSS file and rebuilds again.

We really want to improve how all this stuff works but it requires some changes to popular build tools to better support directories as dependencies from within PostCSS, can see our progress on that here:

postcss/postcss#1537

You can opt-in to a different method that seems to work in your project though right now by setting TAILWIND_DISABLE_TOUCH=true — that will disable our own watchers and rely on the build tool's dependency system, which is good enough for our needs in Rollup (but not in every other tool yet).

It's a bit slower because we can't do as many of our own context-specific optimizations when we outsource the dependency tracking, but it's still very very fast.

Going to close since there's a workaround for this and the bigger picture problem is a very known issue that we are working hard to improve already 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants