Skip to content

@tailwindcss/vite@^4.0.8 is not able to find classes from component based config and components #16939

Closed
@nachoaldamav

Description

@nachoaldamav

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?

  • Vite 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

  • The config file (css) is loaded from @my-org/tailwind-config/styles.css.
  • A button component loaded from @my-org/button.
  • Theorically, using @source "../node_modules/@my-org/button would fix it, but it doesn't.
  • This could be caused by pnpm node_modules structure, as the config file is not loaded from node_modules/@my-org/tailwind-config/styles.css, but from node_modules/.pnpm/@[email protected]/node_modules/@my-org/tailwind-config/styles.css.
  • About pnpm, it means that @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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions