Skip to content

@source doesn't work if dist/ is in the gitignore. #16669

Closed
@adambirds

Description

@adambirds

What version of Tailwind CSS are you using?

v4.0.7

What build tool (or framework if it abstracts the build tool) are you using?

NextJS 15.1.7

What version of Node.js are you using?

Node 23

What browser are you using?

Any browser

What operating system are you using?

MacOS (Linux with Docker)

Reproduction URL

https://github.com/adambirds/tailwind-issue-reproduction

The reproduction may not use those exact versions as was put together quickly, and my main app is dockerised.

Describe your issue

If dist/ is in your .gitignore file, it causes the @source directive to have issues when trying to tell tailwind to look for source files in a package in node_modules. Using my reproduction repo, you can edit globals.css to cause the issue to appear.

If set to the below it doesn't work even though it should.

@import 'tailwindcss';
@source '../../node_modules/tablewind';

If set to the below it does, but this isn't desired to have to append the /dist:

@import 'tailwindcss';
@source '../../node_modules/tablewind/dist';

The table in the repro app won't actually work as it requires a complex setup, but you can if the styling works as it will either look like this:

Working:
Image

Not Working:
Image

If you remove dist/ from the .gitignore it works, but it should be possible to have this in there.

It was discussed with @adamwathan here: https://discord.com/channels/486935104384532500/1341775942846255145

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions