Skip to content

New application builder (v17) does not live reload changes in linked libraries #26585

@ChristianOss

Description

@ChristianOss

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

16.2.10

Description

The new application builder does not live reload changes to linked libraries using npm link

In order to make it work for now, revert to the old builder. For a new project, change @angular-devkit/build-angular:application to @angular-devkit/build-angular:browser and "browser": "src/main.ts", to "main": "src/main.ts", in angular.json.

Minimal Reproduction

Firstly, create a new library using terminal

ng new lib-workspace --no-create-application
cd lib-workspace
ng generate library my-lib
ng build
cd dist/my-lib
npm link
cd ../..
ng build --watch

Start another terminal

# Use SCSS and no SSR
ng new application-with-lib
cd application-with-lib
npm link my-lib

Replace app.component.ts

import { Component } from '@angular/core';
import { MyLibComponent } from 'my-lib';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [MyLibComponent],
  template: '<lib-my-lib></lib-my-lib>'
})
export class AppComponent {
}

Add preserveSymlinks = true to angular.json

"projects": {
    "application-with-lib": {
      ...
      "architect": {
        "build": {
          ...
          "options": {
            "preserveSymlinks": true,
            ...
}

Run the app

ng serve

Now change something in your library's my-lib.component.ts. Result is that no changes are reflected in your browser.

Exception or Error

No response

Your Environment

Angular CLI: 17.0.5
Node: 20.9.0
Package Manager: npm 10.1.0
OS: win32 x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.5
@angular-devkit/build-angular   17.0.5
@angular-devkit/core            17.0.5
@angular-devkit/schematics      17.0.5
@schematics/angular             17.0.5
ng-packagr                      17.0.2
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.2

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