Skip to content
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

@tailwindcss/vite breaks url() using resolve.alias #16039

Closed
sapphi-red opened this issue Jan 30, 2025 · 3 comments · Fixed by #16078
Closed

@tailwindcss/vite breaks url() using resolve.alias #16039

sapphi-red opened this issue Jan 30, 2025 · 3 comments · Fixed by #16078

Comments

@sapphi-red
Copy link

What version of Tailwind CSS are you using?

4.0.1

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

Vite 6.0.11 with @tailwindcss/vite 4.0.1

For example: postcss-cli 8.3.1, Next.js 10.0.9, webpack 5.28.0

What version of Node.js are you using?

22.13.0

What browser are you using?

Chrome

What operating system are you using?

Windows

Reproduction URL

https://stackblitz.com/edit/vitejs-vite-twabw18q?file=vite.config.ts,src%2Fstyles%2Fstyle.css&terminal=dev

  1. Download the project from this button
    Image
  2. Run npm i
  3. Run npm run dev
  4. Open http://localhost:5173
  5. The background image is not shown
    Image

Describe your issue

In Vite, I can use alias set with resolve.alias in url(). For example:

.logo.vanilla {
  background-image: url('~/images/javascript.svg');
}

This does not work when @tailwindcss/vite is used. (It works when @tailwind/postcss is used with Vite)

If you comment out plugins: [tailwind()], from vite.config.ts in the reproduction, you can see the background image shown, which is the expected behavior.
Image

@RIPPERO
Copy link

RIPPERO commented Jan 30, 2025

Same issue for me

@virtuallyunknown
Copy link

I am not 100% sure if it's related to this, but I am having a similar problem with postcss and @tailwindcss/postcss plugin, which I detailed here.

If I use url in my main css file, then my build fails.

@philipp-spiess
Copy link
Member

Thanks for the report! We've fixed this now and will release this as part of the next patch release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants