Useful or not, from you.
angular Uncaught TypeError: Cannot read property 'ɵcmp' of undefined

🐞 bug report

Is this a regression?

I don't know. I've tried with 9.0.7 and 9.1.0, but it works the same. I haven't tested earlier versions.

Description

We migrated application from 8.2.3 to 9.1. ng build and ng serve works as expected and application works with no errors. When we build with ng build --prod everything goes fine - no errors. But in production it throws this exception on loading of application:

Uncaught TypeError: Cannot read property 'ɵcmp' of undefined at Object.yA (vendor.a5630b07ff8c3731c011.js:1) at Object.mTkS (main.b71bfbef186c603a7db8.js:1) at a (runtime.081b9fa9cdbc29e694e9.js:1) at Object.vkcX (main.b71bfbef186c603a7db8.js:1) at a (runtime.081b9fa9cdbc29e694e9.js:1) at Object.j0Xk (main.b71bfbef186c603a7db8.js:1) at a (runtime.081b9fa9cdbc29e694e9.js:1) at Object.vtpD (main.b71bfbef186c603a7db8.js:1) at a (runtime.081b9fa9cdbc29e694e9.js:1) at Object.vY5A (main.b71bfbef186c603a7db8.js:1)

In vendor chunk. I explicitly set "vendorChunk": true, but even with false error is only reported in main.

🔬 Minimal Reproduction

I can't share code. I could only try to create some new project, but I would have to use every external library to try to find what is causing error.

🔥 Exception or Error

<pre><code> Uncaught TypeError: Cannot read property 'ɵcmp' of undefined at Object.yA (vendor.a5630b07ff8c3731c011.js:1) at Object.mTkS (main.b71bfbef186c603a7db8.js:1) at a (runtime.081b9fa9cdbc29e694e9.js:1) at Object.vkcX (main.b71bfbef186c603a7db8.js:1) at a (runtime.081b9fa9cdbc29e694e9.js:1) at Object.j0Xk (main.b71bfbef186c603a7db8.js:1) at a (runtime.081b9fa9cdbc29e694e9.js:1) at Object.vtpD (main.b71bfbef186c603a7db8.js:1) at a (runtime.081b9fa9cdbc29e694e9.js:1) at Object.vY5A (main.b71bfbef186c603a7db8.js:1) </code></pre>

🌍 Your Environment

Angular Version: <pre><code> Angular: 9.0.7 ... animations, cli, common, compiler, compiler-cli, core, forms ... language-service, localize, platform-browser ... platform-browser-dynamic, platform-server, router Ivy Workspace: Yes

Package Version

@angular-devkit/architect 0.900.7 @angular-devkit/build-angular 0.900.7 @angular-devkit/build-optimizer 0.900.7 @angular-devkit/build-webpack 0.900.7 @angular-devkit/core 9.1.0 @angular-devkit/schematics 9.0.7 @angular/cdk 9.0.1 @ngtools/webpack 9.0.7 @schematics/angular 9.0.7 @schematics/update 0.900.7 rxjs 6.5.4 typescript 3.7.5 webpack 4.41.2

</code></pre>

That's a useful answer
Without any help

@Marka83 thanks, appreciated!