Skip to content

Tailwind v4 Resolution Issue #230

@lorenzolewis

Description

@lorenzolewis

Summary

When using Tailwind (v4) classes in pages or components from a theme those classes don't seem to get picked up by Tailwind when building in a package consuming the theme.

Steps to Reproduce

  1. Clone the template repo
  2. Scaffold an integration to inject the Vite Tailwind plugin (example here)
  3. Use a Tailwind class directly in a theme component, layout, or page (in the reproduction it is bg-blue-500 and bg-red-500 relevant repro code)
  4. Consume that theme in a project and you'll notice it isn't included by Tailwind
  5. You can get it to be bundled by including a class (or a string that's the same as the class) in the consumed project (relevant repro code)

Repro

Note: You may need to build and then preview the project to see the issue as I've had mix results during astro dev
https://github.com/lorenzolewis/atp-tailwind-repro

More Info

I feel like this is some Vite virtual module resolution issue (given how much amazing magic is being done under the hood here). It could also very well be an issue in the Tailwind codebase because of the virtual module layers, but I'm not sure how to further dig into it.

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