Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
PostCSS: Fix Turbopack 'one-revision-behind' bug
  • Loading branch information
philipp-spiess committed Apr 4, 2025
commit 9ea4c494a7b480d26e6857ab2a6ff6728474651d
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Nothing yet!
### Fixed

- PostCSS: Resolve an issue where changes to the input CSS file showed outdated content when using Turbopack ([#17554](https://github.com/tailwindlabs/tailwindcss/pull/17554))

## [4.1.2] - 2025-04-03

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* the content for this file is set in the tests */
22 changes: 22 additions & 0 deletions packages/@tailwindcss-postcss/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,3 +420,25 @@ describe('concurrent builds', () => {
expect(await promise2).toContain('.red')
})
})

test('does not register the input file as a dependency, even if it is passed in as relative path', async () => {
let processor = postcss([
tailwindcss({ base: `${__dirname}/fixtures/example-project`, optimize: { minify: false } }),
])

let result = await processor.process(`@tailwind utilities`, { from: './input.css' })

expect(result.css.trim()).toMatchInlineSnapshot(`
".underline {
text-decoration-line: underline;
}"
`)

// Check for dependency messages
expect(result.messages).not.toContainEqual({
type: 'dependency',
file: expect.stringMatching(/input.css$/g),
parent: expect.any(String),
plugin: expect.any(String),
})
})
4 changes: 3 additions & 1 deletion packages/@tailwindcss-postcss/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,12 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin {
if (compiler.features & Features.Utilities) {
DEBUG && I.start('Register dependency messages')
// Add all found files as direct dependencies
// Note: With Turbopack, the input file might not be a resolved path
let resolvedInputFile = path.resolve(base, inputFile)
for (let file of context.scanner.files) {
let absolutePath = path.resolve(file)
// The CSS file cannot be a dependency of itself
if (absolutePath === result.opts.from) {
if (absolutePath === resolvedInputFile) {
continue
}
result.messages.push({
Expand Down