Skip to content

Commit 667af25

Browse files
Vite: Don't rebase absolute url()s (#15275)
Closes #15269 This PR fixes an issue where our Vite extension was rebasing absolute urls inside `@import`-ed files. We forgot to cover this when we implemented the URL rebasing. ## Test Plan We validated that this fixes the repro in #15269: <img width="851" alt="Screenshot 2024-12-02 at 18 07 35" src="https://github.com/user-attachments/assets/3b2c2be3-1f73-469e-9f64-301c6b948b02"> Also added a unit test for this. Co-authored-by: Jordan Pittman <[email protected]>
1 parent 6af4835 commit 667af25

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Ensure absolute `url()`s inside imported CSS files are not rebased when using `@tailwindcss/vite`
13+
1014
### Added
1115

1216
- Parallelize parsing of individual source files ([#15270](https://github.com/tailwindlabs/tailwindcss/pull/15270))

packages/@tailwindcss-node/src/urls.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ export async function rewriteUrls({
5151
let promises: Promise<void>[] = []
5252

5353
function replacerForDeclaration(url: string) {
54+
if (url[0] === '/') return url
55+
5456
let absoluteUrl = path.posix.join(normalizePath(base), url)
5557
let relativeUrl = path.posix.relative(normalizePath(root), absoluteUrl)
5658

0 commit comments

Comments
 (0)