Skip to content

Commit aac468c

Browse files
Pick up changes from files that are both context and content deps (#9787)
* Pick up changes from files that are both context and content deps We switched to absolute paths and it broke this revealing a lurking bug. Fun. * Update changelog * Update changelog
1 parent 1f5d117 commit aac468c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
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
- Fixed use of `raw` content in the CLI ([#9773](https://github.com/tailwindlabs/tailwindcss/pull/9773))
13+
- Pick up changes from files that are both context and content deps ([#9787](https://github.com/tailwindlabs/tailwindcss/pull/9787))
1314

1415
## [3.2.2] - 2022-11-04
1516

src/lib/content.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,14 @@ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
196196
let prevModified = fileModifiedMap.has(file) ? fileModifiedMap.get(file) : -Infinity
197197
let modified = fs.statSync(file).mtimeMs
198198

199-
if (modified > prevModified) {
199+
// This check is intentionally >= because we track the last modified time of context dependencies
200+
// earier in the process and we want to make sure we don't miss any changes that happen
201+
// when a context dependency is also a content dependency
202+
// Ideally, we'd do all this tracking at one time but that is a larger refactor
203+
// than we want to commit to right now, so this is a decent compromise.
204+
// This should be sufficient because file modification times will be off by at least
205+
// 1ms (the precision of fstat in Node) in most cases if they exist and were changed.
206+
if (modified >= prevModified) {
200207
changedFiles.add(file)
201208
fileModifiedMap.set(file, modified)
202209
}

0 commit comments

Comments
 (0)