Skip to content

HMR with external component styles + jit mode shows previous update on save #28885

@mattlewis92

Description

@mattlewis92

Command

serve

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

When trying out the new HMR in angular 19, I found an issue when using jit mode to serve (i.e. "aot": false). HMR of styles is working, but on the first change nothing happens, and then on subsequent changes, the last change takes effect. The same issue is not present with aot mode (we are unable to use aot in our application as incremental rebuilds take ~2 minutes each time). This does not appear to affect inline component <style> tags and only for styles added via the styleUrl property.

Minimal Reproduction

  1. Create a new angular application with latest rc of angular 19
  2. Set "aot": false in the angular.json
  3. Change src/app/app.component.html to <h1>Hello world!</h1>
  4. Change src/app/app.component.scss to h1 { color: red; } and observe nothing happens
  5. Change src/app/app.component.scss to h1 { color: blue; } and observe the h1 tag is now red instead of blue. Any future style updates now show the previous update.
    Image

Exception or Error


Your Environment

Angular CLI: 19.0.0-rc.2
Node: 20.15.0
Package Manager: npm 10.7.0
OS: darwin arm64

Angular: 19.0.0-rc.3
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1900.0-rc.2
@angular-devkit/build-angular   19.0.0-rc.2
@angular-devkit/core            19.0.0-rc.2
@angular-devkit/schematics      19.0.0-rc.2
@angular/cli                    19.0.0-rc.2
@schematics/angular             19.0.0-rc.2
rxjs                            7.8.1
typescript                      5.6.3
zone.js                         0.15.0

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions