Skip to content

@tailwindcss/postcss fails to resolve font URLs in external packages with Vite #16636

@janko

Description

@janko

What version of Tailwind CSS are you using?

v4.0.6

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

Vite 6.1.0

What version of Node.js are you using?

v22.12.0

What browser are you using?

N/A

What operating system are you using?

macOS

Reproduction

https://github.com/janko/tailwind-postcss-bug

Describe your issue

The CSS entrypoint imports @fortawesome/fontawesome-free package CSS. When you run npm run build, you'll see errors indicating that font URLs within that CSS have failed to resolve:

../webfonts/fa-brands-400.woff2 referenced in ../webfonts/fa-brands-400.woff2 didn't resolve at build time, it will remain unchanged to be resolved at runtime

../webfonts/fa-regular-400.woff2 referenced in ../webfonts/fa-regular-400.woff2 didn't resolve at build time, it will remain unchanged to be resolved at runtime

../webfonts/fa-solid-900.woff2 referenced in ../webfonts/fa-solid-900.woff2 didn't resolve at build time, it will remain unchanged to be resolved at runtime

../webfonts/fa-v4compatibility.woff2 referenced in ../webfonts/fa-v4compatibility.woff2 didn't resolve at build time, it will remain unchanged to be resolved at runtime

../webfonts/fa-brands-400.ttf referenced in ../webfonts/fa-brands-400.ttf didn't resolve at build time, it will remain unchanged to be resolved at runtime

../webfonts/fa-regular-400.ttf referenced in ../webfonts/fa-regular-400.ttf didn't resolve at build time, it will remain unchanged to be resolved at runtime

../webfonts/fa-solid-900.ttf referenced in ../webfonts/fa-solid-900.ttf didn't resolve at build time, it will remain unchanged to be resolved at runtime

../webfonts/fa-v4compatibility.ttf referenced in ../webfonts/fa-v4compatibility.ttf didn't resolve at build time, it will remain unchanged to be resolved at runtime

This exact same setup works without issues on Tailwind v3, so it seems like a regression in v4.

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