Description
We generate an Typscripte Api client for Angular with this Mavenplugin https://github.com/swagger-api/swagger-codegen/tree/master/modules/swagger-codegen-maven-plugin . After that we publish the generated client code to a private npm repro. Then we integrate it into an Angular project and embed like in this tutorial: https://angular.schule/blog/2018-04-swagger-codegen .
after building the project with the folowing command
ng serve --prod
We get the follwing error:
Error during template compile of 'SwaggerModule' Only initialized variables and constants can be referenced in decorators because the value of this variable is needed by the template compiler in 'BASE_PATH' 'BASE_PATH' references 'BASE_PATH' 'BASE_PATH' is not initialized at ..
ng serve without production works totaly fine.
Swagger-codegen version
2.31
Swagger declaration file content or url
Command line used for generation
<language>typescript-angular</language>
<output>...</output>
<configOptions>
<packageName>labcom.agriportal</packageName>
<npmName>@swagger/AgriportalProxy</npmName>
<npmVersion>0.0.4</npmVersion>
<snapshot>true</snapshot>
<ngVersion>5.2.10</ngVersion>
<npmRepository>... </npmRepository>
</configOptions>
Steps to reproduce
- generate Typscript Api Client for Angular 5.2.10
- publish to npm
- import it into an plain angular project
- Set BASE_PATH in the AppModule like:
import { ApiModule, BASE_PATH } from 'swaggerPackage ... providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }], '
- Build project in production mode with:
ng serve --prod
Related issues/PRs
Suggest a fix/enhancement
Description
We generate an Typscripte Api client for Angular with this Mavenplugin https://github.com/swagger-api/swagger-codegen/tree/master/modules/swagger-codegen-maven-plugin . After that we publish the generated client code to a private npm repro. Then we integrate it into an Angular project and embed like in this tutorial: https://angular.schule/blog/2018-04-swagger-codegen .
after building the project with the folowing command
ng serve --prodWe get the follwing error:
ng serve without production works totaly fine.
Swagger-codegen version
2.31
Swagger declaration file content or url
Command line used for generation
Steps to reproduce
import { ApiModule, BASE_PATH } from 'swaggerPackage ... providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }], 'ng serve --prodRelated issues/PRs
Suggest a fix/enhancement