Closed lubos-bistak closed 7 years ago
I know the error message is a bit verbose, but the in first lines is the real error:
ERROR in ./src/$$_gendir/app/app.module.ngfactory.ts
Module not found: Error: Can't resolve 'my-library/src/my-library.module' in '<ABSOLUTE-PATH>/my-library/demo-app/src/$$_gendir/app'
resolve 'my-library/src/my-library.module' in '<ABSOLUTE-PATH>/demo-app/src/$$_gendir/app'
This basically means that your library can't be found. The likely cause for this is the way you package your library. I can't verify that the articles you mentioned do it the right way, but you can find some information about packaging and using libraries in https://github.com/angular/angular-cli/wiki/stories-linked-library and https://github.com/angular/angular-cli/issues/6510.
the issue is that the compiler looks for a .ts file, but when the library is installed generates a .d.ts file, There's a workaround where you rename the file removing the .d but... is there another solution?
Plese help!
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.
Bug Report or Feature Request (mark with an
x
)Building Angular4 application with AoT referencing an Angular4 library containing only
*.d.ts
and*.metadata.json
leads to ERRORField 'browser' doesn't contain a valid alias configuration
.According to articles:
After including also library source files
*.js
into npm distribution , AoT build of application referencing this library succeeds.Library structure node_modules/my-libarary
Relevant files of application demo-app built with AoT that is referencing my-library
Versions.
@angular/cli: 1.3.2 node: 8.2.1 os: darwin x64 @angular/animations: 4.3.6 @angular/cdk: 2.0.0-beta.10 @angular/common: 4.3.6 @angular/compiler: 4.3.6 @angular/core: 4.3.6 @angular/forms: 4.3.6 @angular/http: 4.3.6 @angular/platform-browser: 4.3.6 @angular/platform-browser-dynamic: 4.3.6 @angular/router: 4.3.6 @angular/cli: 1.3.2 @angular/compiler-cli: 4.3.6
Repro steps.
ng build -aot
The log given by the failure.
Mention any other details that might be useful.
This error can be reproduced with following
angular-cli
versions: