From 3e9d0d99a84089fcf311415b8fea4271b748dc49 Mon Sep 17 00:00:00 2001 From: Philipp Spiess Date: Mon, 27 Jan 2025 15:21:23 +0100 Subject: [PATCH 1/3] Handle `path.resolve()` returning absolute paths --- packages/@tailwindcss-upgrade/src/template/prepare-config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@tailwindcss-upgrade/src/template/prepare-config.ts b/packages/@tailwindcss-upgrade/src/template/prepare-config.ts index f5a817d40ea3..e936df6a3332 100644 --- a/packages/@tailwindcss-upgrade/src/template/prepare-config.ts +++ b/packages/@tailwindcss-upgrade/src/template/prepare-config.ts @@ -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 } @@ -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([ From 8d8baa95ff502468fd4534e12974b578d65af6ed Mon Sep 17 00:00:00 2001 From: Philipp Spiess Date: Mon, 27 Jan 2025 15:23:30 +0100 Subject: [PATCH 2/3] Also do it for `linkConfigs()` --- packages/@tailwindcss-upgrade/src/migrate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@tailwindcss-upgrade/src/migrate.ts b/packages/@tailwindcss-upgrade/src/migrate.ts index 53b2282561c5..45e75849622d 100644 --- a/packages/@tailwindcss-upgrade/src/migrate.ts +++ b/packages/@tailwindcss-upgrade/src/migrate.ts @@ -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 } From 6b951b9477876ecba94815e0c3966aa6fca57797 Mon Sep 17 00:00:00 2001 From: Philipp Spiess Date: Mon, 27 Jan 2025 15:32:00 +0100 Subject: [PATCH 3/3] Add change log --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1fce67b58f2..e2c5767ce59b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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