service ot found // SOLUTION: add export to `public_api.ts`
See original GitHub issueType of Issue
[x ] Bug Report
[ ] Feature Request
Description
Web pack can not compile
How To Reproduce
I have a module with a component and a service provided. When I do a npm start is works fine but when I install it in another project it says ‘Web pack can not compile’.
This is the configuration of my project: header.module header.component my-service.service
header.component uses my-service.service
Expected Behaviour
It works with only the component in the module but when I add the service as provided inside the module it seems that it can not find that service when I install it in another project. I tried puting in public_api.ts export * from ‘./src/app/modules/header/header.module’; export * from ‘./src/app/services/my-service.service’;
This works and I can access the header.component and my-service.service independently but from the moment the header.component uses the my-service.service it doesn’t work anymore.
Version Information
ng-packagr: ^1.5.0-rc.0
@angular/cli: 1.2.7
node: 7.9.0
os: win32 x64
@angular/animations: 4.4.6
@angular/common: 4.4.6
@angular/compiler: 4.4.6
@angular/core: 4.4.6
@angular/forms: 4.4.6
@angular/http: 4.4.6
@angular/platform-browser: 4.4.6
@angular/platform-browser-dynamic: 4.4.6
@angular/router: 4.4.6
@angular/cli: 1.2.7
@angular/compiler-cli: 4.4.6
@angular/language-service: 4.4.6
please include any version information that might be relevant, e.g. other third-party libraries
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
hi David
thanks for your quick answer. I posted my question just before leaving my workplace today. Then when I arrived home I decided to try it again from scratch based on the example in https://github.com/dherges/ng-packaged.
Now is working very well and I’m very happy.
I think the reason why it didn’t work before with my example at my workplace was because in my public_api.ts I was only exporting: export * from ‘./src/app/modules/header/header.module’; export * from ‘./src/app/services/my-service.service’;
and I think I had to export my component as well.
but on monday when I go back to my workplace I will compare my working example with the not working example and I will let you know why it didin’ work.
cheers O
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
This action has been performed automatically by a bot.