[Bug] Angular builder cannot find built dependent libs
See original GitHub issuePrerequisites
- I am running the latest version
- I checked the documentation (nx.dev) and found no answer
- I checked to make sure that this issue has not already been filed
- I’m reporting the issue to the correct repository (not related to React, Angular or any dependency)
Expected Behavior
Builder @nrwl/angular:package
should be able to locate built dependent libraries in custom locations (not in dist/libs/<lib-name>
) if library output path was changed in it’s ng-package.json
’s dest
property.
Current Behavior
Right now builder @nrwl/angular:package
has hardcoded path to resolve all dependent libs from path that looks like dist/libs/<lib-name>
:
Failure Information (for bugs)
When building a library via @nrwl/angular:package
builder that has another library as dependency that is also built with @nrwl/angular:package
and it’s output path was modified then build fails with:
Some of the library button's dependencies have not been built yet. Please build these libraries before:
- utils
Try: nx run-many --target build --projects button,...
Steps to Reproduce
- Create empty NX workspace
- Generate a publishable angular library called
lib1
- Generate a publishable angular library called
lib2
- Import NgModule from
lib1
intolib2
- Modify
ng-package.json
file oflib1
to changedest
property to other location (./dist
) instead of default../../dist/libs/lib1
- Run
ng build lib1
to build dependency first - Run
ng build lib2
and watch it fails even when we built it’s dependencylib1
Context
> NX Report complete - copy this into the issue template
@nrwl/angular : 9.0.0
@nrwl/cli : 9.0.0
@nrwl/cypress : 9.0.0
@nrwl/eslint-plugin-nx : Not Found
@nrwl/express : Not Found
@nrwl/jest : 9.0.0
@nrwl/linter : Not Found
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 9.0.0
@nrwl/web : Not Found
@nrwl/workspace : 9.0.0
typescript : 3.7.5
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Could not find module "@angular-devkit/build ... - Stack Overflow
After updating to Angular 6.0.1, I get the following error on ng serve : Could not find module "@angular-devkit/build-angular" from ...
Read more >Creating libraries - Angular
This page provides a conceptual overview of how to create and publish new libraries to extend Angular functionality. If you find that you...
Read more >Fixing Could not find module @angular-devkit/build-angular ...
Solution 1: Delete node_modules folder and run npm install · Solution 2 : Install @angular-devkit/build-angular package as a dev dependency.
Read more >@angular-devkit/build-angular - npm
This package contains Architect builders used to build and test Angular applications and libraries. Builders. Name, Description. app-shell ...
Read more >Resolved:Could not find @angular-devkit/build-angular:browser
This error I found to be due to a mismatch in the angular-cli framework and corresponding angular dependencies for a given project. This...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The problem here is that the
angular.json
libs’outputs
property needs to be always in sync with what is in theng-package.json
as of now. We don’t sync them manually, but that needs to be done by the user in case they’re being changed.Basically right now a lib config might look like this:
By default everything works out of the box. If someone changes the
dest
inside theng-package.json
, the output path Nx infers would be out of sync with what is being used by ng-packagr and thus leads to unexpected behaviours. To fix that, add theoutputs
property to the config inangular.json
, like:Hi Author, I am also facing same issue while building lib packages when upgraded to Angular 9. Please let me have the solution for it.