@tailwindcss/vite@^4.0.8
is not able to find classes from component based config and components
#16958
Replies: 6 comments 2 replies
-
I have the same problem. the upgrade from 4.0.7 to 4.0.8 or 4.0.9 broke everything. We are using npm instead of pnpm and macOS instead of Linux, but the issue is the same. |
Beta Was this translation helpful? Give feedback.
-
@nachoaldamav Hey! If I understand you correctly you want one npm package pnpm does indeed move things around with the core assumption that So I think there's two options to making this work:
I was trying to look at your repro to confirm that these indeed fix the issue but for me (using pnpm 10.5.2) the button seems to work fine but I may be missing somethign: ![]() @cvlmtg Mind sharing a reproduction of your setup so we can take a look? |
Beta Was this translation helpful? Give feedback.
-
@philipp-spiess Hi, yes, you are correct, the config does not have dependencies because in my setup (I had to simplify it so you could debug it) this will cause a cyclic dependencies issue (in short config > component > config). I think the Module Graph scanner was a huge feature that eases this stuff by not needing to explicitly set a About the reproduction, it's explained in the readme, these are the steps:
edit: for context, the config would work as a shareable config, I'm not thinking about it to register components paths, but for the styling, plugins, etc... I think the way to see it is that in my setup every component acts as a standalone app (for previews, like Storybook) |
Beta Was this translation helpful? Give feedback.
-
@philipp-spiess Hi Philip, sorry for the delay. Here's a zip with our project stripped down to the (hopefully) bare minimum to replicate the problem. it's a monorepo with the code for our app which can be customized and built for different customers, so the structure of this example might seem strange (like that css with a single import and nothing else) but that's what we need and that worked up until 4.0.7 in the |
Beta Was this translation helpful? Give feedback.
-
I'm experiencing the same issue, though im using vite and npm |
Beta Was this translation helpful? Give feedback.
-
any news on this issue? I just tried tailwind 4.1.1 and the bug is still there. |
Beta Was this translation helpful? Give feedback.
-
What version of Tailwind CSS are you using?
v4.0.9
(4.0.7
works fine)What build tool (or framework if it abstracts the build tool) are you using?
6.2.0
What version of Node.js are you using?
v22.13.1
What browser are you using?
Chrome
What operating system are you using?
Debian (WSL2)
Reproduction URL
https://github.com/nachoaldamav/tailwind-debug-4.0.9
Describe your issue
With the change from the PR #16631 loading config files and component as packages break the candidates search.
Key points
@my-org/tailwind-config/styles.css
.@my-org/button
.@source "../node_modules/@my-org/button
would fix it, but it doesn't.node_modules
structure, as the config file is not loaded fromnode_modules/@my-org/tailwind-config/styles.css
, but fromnode_modules/.pnpm/@[email protected]/node_modules/@my-org/tailwind-config/styles.css
.@source
needs to be../../../../../@my-org/button/dist
which is not very reliable.I think re-opening this PR (#16425) could fix this issue, maybe making the default be the FileSystem one and optionally the Module Graph system.
Beta Was this translation helpful? Give feedback.
All reactions