To exclude all secondary points of a library in a host repo when running ng serve with "npm link" #29170
Labels
angular/build:dev-server
area: @angular/build
feature: votes required
Feature request which is currently still in the voting phase
feature
Issue that requests a new feature
Command
serve
Is this a regression?
The previous version in which this bug was not present was
No response
Description
Background:
I am currently developing a library (my-library) using ng-packagr with multiple secondary entry points. I also have another repo (my-application) that depends on the library. For setting up a local development environment, I am using
npm link
to linkdist/lib-a
to themy-application
repo, runningng watch
inlib-a
andng serve
inmy-application
when performing development.I knew that in order to make
ng serve
detect the code changes from the linked lib-a, I need to do following:architect.build.configurations.development.preserveSymlink: true
In my-library (lib-a), I have these 2 sub-entry points, component-y and service-x. Basically the component-y depends on service-x to show some data that is getting from the token that injected in service-x. In my-application (app.config.ts), I will provide the value of the token.
service-x
component-y
In my-application (app.config.ts)
Actual Issue
Everything is working fine when it is being built or serve in
my-library
.However, in
my-application
, the behavior is not working as I expected when running withng serve
.It produces following error when I navigate to the page that using the component-y:
Observations:
ng serve
.Expected behavior:
Running ng serve with npm link library should behave the same as running ng serve with library that installed using npm install.
I suspect this is a bug because I cant reproduce this in the codes that generated in ng build (preserveSymlink is specified also).
Other Questions:
Thanks and appreciate your help on this.
Minimal Reproduction
my-library:
https://github.com/kjteh/my-library-npm-link
my-application:
https://github.com/kjteh/my-application-npm-link
Steps:
npm run watch
npm link
npm link lib-a --save
ng serve
in my-application-npm-linkException or Error
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: