Skip to content

Fix handling of absolute config files in upgrade tool #15927

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

Merged
merged 3 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Ensure CSS variable shorthand uses valid CSS variables ([#15738](https://github.com/tailwindlabs/tailwindcss/pull/15738))
- Ensure font-size utilities with `none` modifier have a line-height set e.g.: `text-sm/none` ([#15921](https://github.com/tailwindlabs/tailwindcss/pull/15921))
- Ensure font-size utilities with unknown modifier don't generate CSS ([#15921](https://github.com/tailwindlabs/tailwindcss/pull/15921))
- _Upgrade_: Ensure JavaScript config files on different drives are correctly migrated ([#15927](https://github.com/tailwindlabs/tailwindcss/pull/15927))

## [4.0.0] - 2025-01-21

Expand Down
2 changes: 1 addition & 1 deletion packages/@tailwindcss-upgrade/src/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ export async function linkConfigs(
// If the path points to a file in the same directory, `path.relative` will
// remove the leading `./` and we need to add it back in order to still
// consider the path relative
if (!relative.startsWith('.')) {
if (!relative.startsWith('.') && !path.isAbsolute(relative)) {
relative = './' + relative
}

Expand Down
4 changes: 2 additions & 2 deletions packages/@tailwindcss-upgrade/src/template/prepare-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function prepareConfig(
// If the path points to a file in the same directory, `path.relative` will
// remove the leading `./` and we need to add it back in order to still
// consider the path relative
if (!relative.startsWith('.')) {
if (!relative.startsWith('.') && !path.isAbsolute(relative)) {
relative = './' + relative
}

Expand All @@ -49,7 +49,7 @@ export async function prepareConfig(
let newPrefix = userConfig.prefix ? migratePrefix(userConfig.prefix) : null
let input = css`
@import 'tailwindcss' ${newPrefix ? `prefix(${newPrefix})` : ''};
@config './${relative}';
@config '${relative}';
`

let [compiler, designSystem] = await Promise.all([
Expand Down