-
Notifications
You must be signed in to change notification settings - Fork 4.6k
No classes generated in monorepo setup with Yarn PnP #17739
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
Comments
I can confirm that this monorepo (using |
@bjornars probably you can try to use https://tailwindcss.com/docs/detecting-classes-in-source-files#setting-your-base-path |
Thanks, that worked 👍 Sorry for derailing your issue. |
I think this may be due to #16631 that was released in With my machine configuration, I don't have corepack. However, using yarn @import "tailwindcss" prefix(twp);
+
+@source "./"; The commands I ran: $ yarn
$ yarn workspace vite-bundle run dev
Does the aforementioned change help you at all @Wroud? |
@wongjn hmm, yes it works in provided repo, but as i can see it's not reproducing issue correctly, because in vite log i see real path instead of virtual:
i need to check what the difference between this minimal repo and my project |
in my real project i see path like this:
|
okay, i've managed to reproduce it, so if package has |
now i'm also worried that because of scanning based on file system there might be cases when classes will not be picked up in vite virtual modules (that is quite often used in vite plugins) |
Hey! Yeah AFAIK Yarn PnP requires monkey patches of core APIs but since these can only patch the Node.js env and we do some calls from within the Rust native extension, this might not work. I don't think this is something we can solve at the moment without making it much slower for everyone else (since basically we'd need to pipe every IO back to the single JS thread that Yarn has patched...). You might have more success with the WASM build (which uses node napi APIs and thus I/O is on the main JS thread) but that has some known issues with macOS too IIRC (you will find some info in the PR from me that added it). I'm (genuinely) curious if you feel like Yarn PnP provides you much value these days?
Yeah we can't scan Vite virtual modules but these usually have input files that they use to get their content setup anyways. Note that Tailwind is about scanning the template files and not necessarily the build point or runtime. I agree that it might be unexpected though but it's a ripcord we had to pull since the module-graph only implementation had many subtle impossible-to-fix-otherwise issues I'm afraid :( |
We have a specific setup where we use workspaces that don't have a common parent. For now, yarn pnp is the only solution that works for us (it also has a lot of problems like this one, but we can manage most of them) thank you, i will look at WASM build, but for now we can use v4.0.7 version |
What version of Tailwind CSS are you using?
v4.0.8 / v4.1+
What build tool (or framework if it abstracts the build tool) are you using?
Vite 6.1+
What version of Node.js are you using?
v22
What browser are you using?
Chrome latest
What operating system are you using?
macOS
Reproduction URL
https://github.com/Wroud/tailwindcss-yarn-pnp
Describe your issue
I think that this problem is because yarn pnp doesn't use real file system paths, insted it will be something like:
@source
also doesn't work (before v4.1 version it's possible to use absolute paths, but they also not work after v4.1)this setup works well on 4.0.7 version and broken after 88b762b#diff-00d01a2d38f5f4253651cf9811eab1182c96f0307e78c567b803416e24b98165
The text was updated successfully, but these errors were encountered: