diff --git a/CHANGELOG.md b/CHANGELOG.md
index ddc452a3e..c3ee57f18 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Revert change to no longer include theme variables that aren't used in compiled CSS ([#16403](https://github.com/tailwindlabs/tailwindcss/pull/16403))
+### Fixed
+
+- Upgrade: Don't migrate `blur` to `blur-sm` when used with Next.js `` ([#16405](https://github.com/tailwindlabs/tailwindcss/pull/16405))
+
## [4.0.5] - 2025-02-08
### Added
diff --git a/packages/@tailwindcss-upgrade/src/template/codemods/legacy-classes.test.ts b/packages/@tailwindcss-upgrade/src/template/codemods/legacy-classes.test.ts
index f301deaa9..6b8bbe4c6 100644
--- a/packages/@tailwindcss-upgrade/src/template/codemods/legacy-classes.test.ts
+++ b/packages/@tailwindcss-upgrade/src/template/codemods/legacy-classes.test.ts
@@ -68,4 +68,9 @@ test('does not replace classes in invalid positions', async () => {
await shouldNotReplace(`
\n`)
await shouldNotReplace(`\n`)
await shouldNotReplace(`\n`)
+
+ // Next.js Image placeholder cases
+ await shouldNotReplace(``, 'blur')
+ await shouldNotReplace(``, 'blur')
+ await shouldNotReplace(``, 'blur')
})
diff --git a/packages/@tailwindcss-upgrade/src/template/is-safe-migration.ts b/packages/@tailwindcss-upgrade/src/template/is-safe-migration.ts
index e0408d3e5..dc84d3022 100644
--- a/packages/@tailwindcss-upgrade/src/template/is-safe-migration.ts
+++ b/packages/@tailwindcss-upgrade/src/template/is-safe-migration.ts
@@ -10,6 +10,7 @@ const CONDITIONAL_TEMPLATE_SYNTAX = [
/x-if=['"]$/,
/x-show=['"]$/,
]
+const NEXT_PLACEHOLDER_PROP = /placeholder=\{?['"]$/
export function isSafeMigration(location: { contents: string; start: number; end: number }) {
let currentLineBeforeCandidate = ''
@@ -63,5 +64,10 @@ export function isSafeMigration(location: { contents: string; start: number; end
}
}
+ // Heuristic: Disallow Next.js Image `placeholder` prop
+ if (NEXT_PLACEHOLDER_PROP.test(currentLineBeforeCandidate)) {
+ return false
+ }
+
return true
}