Useful or not, from you.
angular-cli Uncaught (in promise): TypeError: ctor is not a constructor

🐞 Bug report

Command (mark with an x)

<!-- Can you pin-point the command or commands that are effected by this bug? --> <!-- ✍️edit: -->

- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Can't tell.


When running an application built in prod mode ng build --prod some components cannot be instantiated because of TypeError: ctor is not a constructor. This is a continuation of

🔬 Minimal Reproduction

<!-- Simple steps to reproduce this bug.

Please include: commands run (including args), packages added, related code changes.

If reproduction steps are not enough for reproduction of your issue, please create a minimal GitHub repository with the reproduction of the issue. Share the link to the repo below along with step-by-step instructions to reproduce the problem, as well as expected and actual behavior.

Issues that don't have enough info and can't be reproduced will be closed.

You can read more about issue submission guidelines here: -->

  1. Clone
  2. run ng build --prod
  3. Launch app in the browser and witness the error.

🔥 Exception or Error

<pre><code> TypeError: ctor is not a constructor at createClass (core.js.pre-build-optimizer.js:22052) at createDirectiveInstance (core.js.pre-build-optimizer.js:21931) at createViewNodes (core.js.pre-build-optimizer.js:23157) at callViewAction (core.js.pre-build-optimizer.js:23473) at execComponentViewsAction (core.js.pre-build-optimizer.js:23392) at createViewNodes (core.js.pre-build-optimizer.js:23185) at callViewAction (core.js.pre-build-optimizer.js:23473) at execComponentViewsAction (core.js.pre-build-optimizer.js:23392) at createViewNodes (core.js.pre-build-optimizer.js:23185) at createRootView (core.js.pre-build-optimizer.js:23071) at resolvePromise (zone.js.pre-build-optimizer.js:831) at resolvePromise (zone.js.pre-build-optimizer.js:788) at zone.js.pre-build-optimizer.js:892 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js.pre-build-optimizer.js:423) at Object.onInvokeTask (core.js.pre-build-optimizer.js:17280) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js.pre-build-optimizer.js:422) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js.pre-build-optimizer.js:195) at drainMicroTaskQueue (zone.js.pre-build-optimizer.js:601) </code></pre>

🌍 Your Environment

<pre><code> Angular CLI: 7.2.2 Node: 10.15.0 OS: linux x64 Angular: 7.2.1 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.12.2 @angular-devkit/build-angular 0.12.2 @angular-devkit/build-optimizer 0.12.2 @angular-devkit/build-webpack 0.12.2 @angular-devkit/core 7.2.2 @angular-devkit/schematics 7.2.2 @angular/cli 7.2.2 @ngtools/webpack 7.2.2 @schematics/angular 7.2.2 @schematics/update 0.12.2 rxjs 6.3.3 typescript 3.2.4 webpack 4.28.4 </code></pre>

That's a useful answer
Without any help

Still I see the error when I do ng build --prod. All router navigations are working fine but in one component the router navigation is not working and throwing the below error. If anyone could help me please. image