Skip to content

fix(@angular/build): rebuild stylesheets when files are added to a PostCSS directory dependency - #34451

Open
MeAkib wants to merge 2 commits into
angular:mainfrom
MeAkib:fix/postcss-dir-dependency-watch
Open

MeAkib wants to merge 2 commits into
angular:mainfrom
MeAkib:fix/postcss-dir-dependency-watch

Conversation

@MeAkib

@MeAkib MeAkib commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Previously, a PostCSS dir-dependency message (used by Tailwind CSS v4 for its content sources) was expanded with a glob and only the files that existed at build time were watched. Files created later, or moved by renaming their folder, did not invalidate the cached stylesheet, so classes used only in them were not generated until the stylesheet itself changed.

The directory is now also added to the watch files, and the load result cache invalidates an entry when a changed path is inside one of its watched directories.

Fixes #34446

…stCSS directory dependency

Previously, a PostCSS `dir-dependency` message (used by Tailwind CSS v4 for its content sources) was
expanded with a glob and only the files that existed at build time were watched. Files created later,
or moved by renaming their folder, did not invalidate the cached stylesheet, so classes used only in
them were not generated until the stylesheet itself changed.

The directory is now also added to the watch files, and the load result cache invalidates an entry
when a changed path is inside one of its watched directories.

Fixes angular#34446

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for directory dependencies (such as PostCSS dir-dependency) by watching the dependency directory itself and updating the cache invalidation logic to check parent directories recursively. The review feedback suggests normalizing the input path in the invalidate method to ensure OS-consistent path matching when looking up file dependencies.

Comment thread packages/angular/build/src/tools/esbuild/load-result-cache.ts Outdated
@MeAkib
MeAkib force-pushed the fix/postcss-dir-dependency-watch branch from 22295e9 to 8462bbf Compare October 20, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tailwind CSS v4 classes in new or moved files are not picked up by ng serve until another rebuild

1 participant