Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#34,446 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@MeAkib 已经在做这个了。

开始于 2026年10月20日。

  • #34451 来自 @MeAkib —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
angular, node.js, tailwindcss, typescript

调研方向

Start with src/tools/esbuild/stylesheets/stylesheet-plugin-factory.js, where PostCSS directory dependency messages are expanded and existing files are added to watchFiles. Trace how esbuild receives watch dependencies and how file add, unlink, or rename events are handled. Done means the reproduction generates classes for newly created or moved source files on the next rebuild; an open linked pull request indicates work is already underway.

由索引模型根据 Issue 内容生成。

描述

area: @angular/build
Command

build

Is this a regression?
  • Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was

No response

Description

In @angular/build 22.2.2 (and 22.2.3), src/tools/esbuild/stylesheets/stylesheet-plugin-factory.js handles PostCSS dir-dependency messages by expanding the glob with tinyglobby and adding the resulting files to watchFiles. Only files that exist at build time are watched. A file created later, or moved by renaming its folder, is never watched, so classes used only in it are not generated until something else triggers a stylesheet rebuild. esbuild has no directory/glob watch to fall back on, so the dir itself should probably be watched (or the glob re-expanded on add/unlink events).

Minimal Reproduction
  1. Angular 22 app with Tailwind v4 via @tailwindcss/postcss; run ng serve.
  2. Create src/app/foo/foo.ts using a class not used elsewhere, e.g. bg-[#123456]. It is generated.
  3. Rename the folder to src/app/bar/ and edit the file to use bg-[#654321]. The class is not generated.
  4. Touch src/styles.css. Now it is generated.

NG_BUILD_WATCH_ROOT=1 stops detecting changes entirely. Polling ("poll": 1000) doesn't help either.

Exception or Error
Classes in files added or moved under Tailwind's sources are generated on the next rebuild, as with modifications.
Your Environment
_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI       : 22.2.0
Angular           : 22.2.0
Node.js           : 24.15.0
Package Manager   : bun 1.4.2
Operating System  : linux x64

┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package                   │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/aria             │ 22.2.0            │ 22.2.0            │
│ @angular/build            │ 22.2.0            │ 22.2.0            │
│ @angular/cdk              │ 22.2.0            │ 22.2.0            │
│ @angular/cli              │ 22.2.0            │ 22.2.0            │
│ @angular/common           │ 22.2.0            │ 22.2.0            │
│ @angular/compiler         │ 22.2.0            │ 22.2.0            │
│ @angular/compiler-cli     │ 22.2.0            │ 22.2.0            │
│ @angular/core             │ 22.2.0            │ 22.2.0            │
│ @angular/material         │ 22.2.0            │ 22.2.0            │
│ @angular/platform-browser │ 22.2.0            │ 22.2.0            │
│ @angular/platform-server  │ 22.2.0            │ 22.2.0            │
│ @angular/router           │ 22.2.0            │ 22.2.0            │
│ @angular/ssr              │ 22.2.0            │ 22.2.0            │
│ rxjs                      │ 7.8.2             │ ^7.8.2            │
│ typescript                │ 6.0.2             │ 6.0.2             │
│ vitest                    │ 4.1.11            │ 4.1.11            │
Anything else relevant?

No response

主要语言
TypeScript
星标
27k
派生
11.8k
平均合并
1 天 6 小时
30 天内合并 PR
224

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

angular/angular-cli 的其他 Issue

查看 angular/angular-cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。