Repository navigation
tailwind not generating basic classes in pnpm project #20743
|
What version of Tailwind CSS are you using? v4.3.5 What build tool (or framework if it abstracts the build tool) are you using? "@tailwindcss/vite": "^4.3.5", What version of Node.js are you using? v26.13.0 What browser are you using? Safari What operating system are you using? macOS Reproduction URL Describe your issue In the mono repo i have a library of vue components which are correctly getting their tailwind styles applied, and an application (nuxt) which uses that library (works) and applies many utilities (flex, grid text-size etc) which dont work. the utilities are not forming correctly and are not generating any CSS. In the repro, i am observing the underline applying but not the text size
This was working previously before i started using the pnpm catalog workspace, however because i am able to reproduce out side of that i believe this is a deeper issue. |
Replies: 4 comments 4 replies
|
In Tailwind CSS v4 (using However, in PNPM catalog workspaces and monorepos, Tailwind v4's scanner by default does not follow symlinks or scan directories outside of the package's local project root (such as shared component libraries located in How to Fix in Tailwind CSS v4:In your main CSS entry file (where @import "tailwindcss";
/* Explicitly tell Tailwind v4 to scan your shared component library */
@source "../../packages/ui/src/**/*.{vue,js,ts,jsx,tsx}";
@source "../path-to-your-components/**/*.{vue,js,ts,jsx,tsx}";Why this happens with PNPM:
Once you add the If this resolves the missing classes in your PNPM setup, please consider marking this as the accepted answer. |
|
Since it starts working when you copy the app to another folder, check whether the original path is git-ignored. Tailwind v4's automatic source detection skips anything matched by From the app folder, run: git check-ignore -v app/app.vueIf it prints a rule, that rule is why the classes aren't generated. Remove or narrow that rule, or register the folder explicitly in your CSS, because explicit sources are scanned even when ignored: @import "tailwindcss";
@source "./app"; |
|
I tested the
That also fits "it works when I copy it to a new folder": outside the repo, the rule no longer applies. From the app folder: git check-ignore -v app/app.vueIf it prints a rule, either narrow/remove that rule, or register the folder explicitly. Explicit @import "tailwindcss";
@source "../app"; /* relative to this CSS file */Two things that confused me while testing:
(I only tested with the CLI, not through |



Since it starts working when you copy the app to another folder, check whether the original path is git-ignored. Tailwind v4's automatic source detection skips anything matched by
.gitignore. That includes.gitignorefiles in parent directories and your global gitignore (core.excludesFile), not just the one in your project.From the app folder, run:
If it prints a rule, that rule is why the classes aren't generated. Remove or narrow that rule, or register the folder explicitly in your CSS, because explicit sources are scanned even when ignored: