Skip to content

HMR doesn't work with "aot": false #30352

Closed

Description

@anhallbe

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 angular.json is configured with "aot": false, HMR doesn't work at all.

Minimal Reproduction

  1. Create a project with ng new
  2. In angular.json, add "aot": false to the build options (i.e projects > project > architect > build > options
  3. Run ng serve
  4. In the browser, open the dev tools & network tab
  5. Make a change in any file, e.g the component HTML, TS, or CSS
  6. Notice that the browser does a full refresh

Exception or Error


Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 19.2.12
Node: 22.15.1
Package Manager: npm 11.4.0
OS: darwin arm64

Angular: 19.2.11
... common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1902.12
@angular-devkit/build-angular   19.2.12
@angular-devkit/core            19.2.12
@angular-devkit/schematics      19.2.12
@angular/cli                    19.2.12
@schematics/angular             19.2.12
rxjs                            7.8.2
typescript                      5.7.3
zone.js                         0.15.0

Anything else relevant?

Issue can be reproduced regardless of browser and OS.

Activity

  1. clydin commented on May 21, 2025

    @clydin
    Member

    This is expected behavior. The build system requires knowledge of the Angular components within the application to be able to send partial updates of individual components. With JIT mode, Angular components are compiled in the browser and the build system only sees TypeScript code.

    JIT mode is typically not recommended outside of testing scenarios.

  2. anhallbe commented on May 21, 2025

    @anhallbe
    Author

    That's what I feared, although I was hoping the answer would be something different since we're stuck with JIT for the foreseeable future... 😅

    Thanks for the explanation.

    On a related note: A warning message or some kind of log would probably help others in a similar situation. The only HMR-related message we're seeing is the one saying that it's enabled:

    Component HMR has been enabled.
    If you encounter application reload issues, you can manually reload the page to bypass HMR and/or disable this feature with the `--no-hmr` command line option.
    Please consider reporting any issues you encounter here: https://github.com/angular/angular-cli/issues
  3. alan-agius4 commented on May 21, 2025

    @alan-agius4
    Collaborator

    Closed via #30362

  4. angular-automatic-lock-bot commented on Jun 21, 2025

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  5. locked and limited conversation to collaborators on Jun 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions