Error in production build after update to Angular 8
See original GitHub issue🐞 bug report
Affected Package
The issue is caused by package @angular/....Is this a regression?
Yes, It occurred after update to Angular 8. I didn’t change any environments files, or configuration. Previously I used Angular 7.
Description
Production build fails using Angular 8.
Here is my configuration:
"my-prod": { "optimization": true, "outputHashing": "all", "sourceMap": true, "extractCss": true, "namedChunks": false, "aot": true, "extractLicenses": true, "vendorChunk": false, "buildOptimizer": true, "fileReplacements": [ { "replace": "src/environments/environment.ts", "with": "src/environments/environment.my-prod.ts" } ] },
I use command to build: ng build --prod --configuration=my-prod
🔥 Exception or Error
ERROR in src/__ng_typecheck__.ts(334,62): error TS2344: Type '"enabled" | "minRows" | "maxRows" | "cdkAutosizeMinRows" | "cdkAutosizeMaxRows" | "matAutosizeMinRows" | "matAutosizeMaxRows" | "matAutosize" | "matTextareaAutosize"' does not satisfy the constraint '"ngOnDestroy" | "ngDoCheck" | "enabled" | "reset" | "ngAfterViewInit" | "minRows" | "maxRows" | "matAutosizeMinRows" | "matAutosizeMaxRows" | "matAutosize" | "matTextareaAutosize" | "_setMinHeight" | "_setMaxHeight" | "resizeToFitContent" | "_noopInputHandler"'.
Type '"cdkAutosizeMinRows"' is not assignable to type '"ngOnDestroy" | "ngDoCheck" | "enabled" | "reset" | "ngAfterViewInit" | "minRows" | "maxRows" | "matAutosizeMinRows" | "matAutosizeMaxRows" | "matAutosize" | "matTextareaAutosize" | "_setMinHeight" | "_setMaxHeight" | "resizeToFitContent" | "_noopInputHandler"'.
🌍 Your Environment
Angular Version:
Angular CLI: 8.0.1
Node: 12.4.0
OS: darwin x64
Angular: 8.0.0
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, material, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.800.1
@angular-devkit/build-angular 0.800.1
@angular-devkit/build-optimizer 0.800.1
@angular-devkit/build-webpack 0.800.1
@angular-devkit/core 8.0.1
@angular-devkit/schematics 0.6.8
@angular/cli 8.0.1
@angular/http 8.0.0-beta.10
@ngtools/webpack 8.0.1
@schematics/angular 8.0.1
@schematics/update 0.800.1
rxjs 6.5.2
typescript 3.4.5
webpack 4.30.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
@santoshyadav198613 Hello 😃
Wow, the 4th point was actually very very helpful. I had enabled the Ivy 😦 I switched this off and now my build is working 🎉
Thanks very much!
The template type-checking is a new feature added in Ivy recently which being released at version 8. Also, template type-checking is designed to check your template usage, and break the build on any violation, a type-error is basically a BUG in your app (as long as what reported is correct and expected). Ivy is only designed for preview purpose now, that mean any real project should not use Ivy (except for testing compatibility).
If you use Ivy in any real project (even in v7 or before?), you’re putting your project on your own risk.