Skip to content

Commit 3386049

Browse files
authored
Fix upgrade error when using @import … source(…) (#17963)
This PR fixes an issue when running the upgrade tool and if any of the CSS files has an import that looks like this: ```css @import "tailwindcss" source("…"); ``` This was trying to resolve `tailwindcss" source("…` instead of `tailwindcss`. This PR fixes that. ## Test plan 1. Ran it locally on a project Before: <img width="1158" alt="image" src="https://github.com/user-attachments/assets/09bf5d69-797c-4330-ade1-edc213f7ce5c" /> After: <img width="1029" alt="image" src="https://github.com/user-attachments/assets/d1c9e194-30e2-4564-83c5-d9a259a67e90" />
1 parent 737994b commit 3386049

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Fixed
1111

1212
- Allow `_` before numbers during candidate extraction ([#17961](https://github.com/tailwindlabs/tailwindcss/pull/17961))
13+
- Upgrade: Fix error when using `@import … source(…)` ([#17963](https://github.com/tailwindlabs/tailwindcss/pull/17963))
1314

1415
## [4.1.6] - 2025-05-09
1516

packages/@tailwindcss-upgrade/src/codemods/css/analyze.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export async function analyze(stylesheets: Stylesheet[]) {
3939
AtRule: {
4040
import(node) {
4141
// Find what the import points to
42-
let id = node.params.match(/['"](.*)['"]/)?.[1]
42+
let id = node.params.match(/['"](.*?)['"]/)?.[1]
4343
if (!id) return
4444

4545
let basePath = node.source?.input.file

0 commit comments

Comments
 (0)