-
Notifications
You must be signed in to change notification settings - Fork 4.5k
@tailwindcss/postcss fails to resolve font URLs in external packages with Vite #16636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If I switch from Personally I would love to switch to |
Same issue here using vite. |
i also had issue with vite plugin. upgrading laravel application with vite, if i use vite plugin i have several compilation error, with postcss plugin works well |
@janko Huh, do you have a setup how this works without the Tailwind PostCSS plugin? I think that the import to What you can try is to change using an @import url("@fortawesome/fontawesome-free/css/all.css");
@import "tailwindcss"; (Note that it will need to be reordered though since the latter import will expand into CSS) @DonCamillo11 @neapolis79 Do you mind attaching a repro and creating a new issue report? If you're using the Vite plugin this should work since we do url rebasing there. |
@philipp-spiess I just pushed
I might be misunderstanding, but isn't Vite my bundler here? There is no Vite config in any of the branches other than the The Vite build output shows whether fonts were resolved, and I also tested rendering the icon to verify it. This is the successful build:
and this is the unsuccessful build (font files are absent):
|
@janko Ah sorry I oversaw Vite here, sorry! 🤦 Thanks for the repro. Will need to look more into it and have to understand what Vite does behind the scenes here so that it works with no Tailwind CSS plugin present 🤔 |
@philipp-spiess please see this issue here |
Apologies if this is off topic or caused by a different issue, but this workaround also fixed my problem. My issue: Vite hot reload fails to pick up changes in SASS files imported into top-level SASS file. My build is Vite + tailwindcss/postcss. Vite css uses modern-compiler api option. main.js: style.scss:
If I change a style in main.scss, Vite pushes a hot-reload of style.scss (which inlines main.scss), but it doesn't include the changes. If I npm run dev from scratch the changes are included. Things which worked: Using url for import: Things I've tried: |
Having the same issue with Webpack and postcss-loader. When the @tailwindcss/postcss plugin is included, imported CSS files from node_modules get inlined without bringing their assets with them. |
Hey folks! Sorry for the long wait but a fix for this is coming with the next patch release. |
Appreciate the fix, thanks! 🙏🏻 |
@philipp-spiess Thanks, but I still have the same problem. |
@DonCamillo11 Mind creating a new GitHub issue with a reproduction for that? Thanks! |
@philipp-spiess Can you please reopen this issue #16700. I just updated the repo, thanks. |
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 runnpm run build
, you'll see errors indicating that font URLs within that CSS have failed to resolve:This exact same setup works without issues on Tailwind v3, so it seems like a regression in v4.
The text was updated successfully, but these errors were encountered: