Troubleshooting NG0203 Error: Issues with Angular Library and HttpClient Injection in...

Discussão em 'Angular' iniciado por Tomasz Jaworski, Novembro 28, 2024.

  1. I wasn't able to solve it. I'm counting on your help.

    I have an Angular application and a library.

    In the library, I have a service where I inject HttpClient. I set HttpClient as a provider in the application. When I run the application using ng serve, everything works fine. However, when I create a build (ng build) and launch the application, I get error NG0203.

    I've attached a link to the repository with this issue.

    To run it:

    1. Build the library (libs directory) - ng build
    2. Launch the application (app1 directory) - ng serve
    3. Create a production build (app1 directory) - ng build
    4. Launch the build using, for example, a live server

    Link to the repository:

    https://github.com/tjaworski997/angular-library-inject-build-problem

    I look forward to your help.

    1. paths in tsconfig.json: "@angular/": ["./node_modules/@angular/"]
    2. "preserveSymlinks": true in angular.json

    Continue reading...

Compartilhe esta Página