diff --git a/CHANGELOG.md b/CHANGELOG.md index e973fcc97524..964f4771f4f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Preserve case of css variables added by plugins ([#6888](https://github.com/tailwindlabs/tailwindcss/pull/6888)) +- Ignore content files that don't exist ([#6901](https://github.com/tailwindlabs/tailwindcss/pull/6901)) ## [3.0.10] - 2022-01-04 diff --git a/src/lib/setupContextUtils.js b/src/lib/setupContextUtils.js index b51b77477bc4..e75aefdbc6b0 100644 --- a/src/lib/setupContextUtils.js +++ b/src/lib/setupContextUtils.js @@ -435,7 +435,14 @@ function trackModified(files, fileModifiedMap) { let parsed = url.parse(file) let pathname = parsed.hash ? parsed.href.replace(parsed.hash, '') : parsed.href pathname = parsed.search ? pathname.replace(parsed.search, '') : pathname - let newModified = fs.statSync(decodeURIComponent(pathname)).mtimeMs + let newModified = fs.statSync(decodeURIComponent(pathname), { throwIfNoEntry: false })?.mtimeMs + if (!newModified) { + // It could happen that a file is passed in that doesn't exist. E.g.: + // postcss-cli will provide you a fake path when reading from stdin. This + // path then looks like /path-to-your-project/stdin In that case we just + // want to ignore it and don't track changes at all. + continue + } if (!fileModifiedMap.has(file) || newModified > fileModifiedMap.get(file)) { changed = true