diff --git a/packages/@tailwindcss-cli/src/commands/build/index.ts b/packages/@tailwindcss-cli/src/commands/build/index.ts index 01d646a6abdf..db0055f8883b 100644 --- a/packages/@tailwindcss-cli/src/commands/build/index.ts +++ b/packages/@tailwindcss-cli/src/commands/build/index.ts @@ -479,10 +479,14 @@ async function createWatchers(dirs: string[], cb: (files: string[]) => void) { await Promise.all( events.map(async (event) => { - // We currently don't handle deleted files because it doesn't influence - // the CSS output. This is because we currently keep all scanned - // candidates in a cache for performance reasons. - if (event.type === 'delete') return + // We track deleted files so that a full rebuild can surface missing + // file errors (e.g. a deleted config dependency). Deleted content files + // are also tracked here but are harmless — they still hit the candidate + // cache so scanFiles returns empty and we bail early. + if (event.type === 'delete') { + files.add(event.path) + return + } // Ignore directory changes. We only care about file changes let stats: Stats | null = null