Angular Prod Build Specific Bugs
Jennifer Fadriquela
Posted on November 20, 2020
I recently upgraded our project to Angular 10 from version 8. Below is a piece of code that went buggy:
@ViewChild('searchTextBox', { read: false }) searchTextBox: ElementRef;
This was working in v8 but not in v10.
The fix is to assign the expected type to 'read' property.
@ViewChild('searchTextBox', { read: ElementRef }) searchTextBox: ElementRef;
As I am debugging this in v10, I noticed that the error is not reproducible when running ng serve
but will appear if you run ng serve --prod
.
Lesson Learned: Always do a sanity test in prod build. Note that prod build is not debuggable and takes a while to build.
💖 💪 🙅 🚩
Jennifer Fadriquela
Posted on November 20, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
angular A Practical guide to building cross-platform apps with Angular, Ionic, Capacitor, and Nx
November 29, 2024