@source directive not working with pnpm
What version of Tailwind CSS are you using?
v4.0.1
What build tool (or framework if it abstracts the build tool) are you using?
Next.js v15.1.6
What version of Node.js are you using?
v20.0.0
What browser are you using?
Firefox
What operating system are you using?
macOS
Reproduction URL
Tailwind 4 with pnpm Tailwind 4 with yarn
Describe your issue
@source directive not working for node_modules packages with pnpm and nextjs. The same code is working with nextjs and yarn, and nextjs and npm, also same package works with pnpm with vite with @tailwindcss/vite
@import "tailwindcss";
@import "@jamsr-ui/theme/styles.css";
/* This is not working */
@source "../node_modules/@jamsr-ui";
/* These are working */
/* @source "../node_modules/@jamsr-ui/text"; */
/* @source "../node_modules/@jamsr-ui/button"; */
/* @source "../node_modules/@jamsr-ui/utils"; */
/* @source "../node_modules"; */
Here @source "../node_modules/@jamsr-ui"; is not working but nested @source are working as like @source "../node_modules/@jamsr-ui/text";.
Even @source "../node_modules" is working
Yaa, how to fix??
This also affects npm as well as discussed here in the discord: https://discord.com/channels/486935104384532500/1341775942846255145
this makes it work;
@import 'tailwindcss';
@source '../../node_modules/tablewind/dist';
but this one doesn't.
@import 'tailwindcss';
@source '../../node_modules/tablewind';
@adambirds Thanks for looking into this and for explaining the issue and potential ways to fix this in #16669. Going to merge this issue into #16669 so we only track this at one place 👍
@philipp-spiess Thanks, but this is not a duplicate of #16669. I don't have dist in .gitignore and this code is working with yarn and npm. This issue is related to pnpm because pnpm create node_modules with symlinks . Setting node-linker=hoisted in .npmrc file solve the issue.
@adityaa72 Thanks for the additional context, I've reopened so we can investigate 👍
Hey!
Alright we figured it out and it should be solved by #17391 and will be available in the next release.