question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Ivy] App crashes at runtime with NgRx 7.x

See original GitHub issue

🐞 bug report

Affected Package

The issue is caused by package @angular/*

Is this a regression?

Yes, the previous version in which this bug was not present was: Angular version 7.x

Description

When using the latest Angular and CLI betas, and running ivy-ngcc, and the latest version of NgRx from npm, the application compiles successfully but fails at runtime.

πŸ”¬ Minimal Reproduction

Reproduction steps are in the README on the repo

https://github.com/brandonroberts/ngrx-ivy-runtime-error

πŸ”₯ Exception or Error

Without adding import 'core-js/es7/reflect'; to src/polyfills.ts and ng serve --aot


main.ts:13 Error: Dependency array must have arguments.
    at reflectDependency (core.js:887)
    at core.js:870
    at Array.map (<anonymous>)
    at convertDependencies (core.js:870)
    at reflectDependencies (core.js:866)
    at Function.get (core.js:956)
    at getInjectableDef (core.js:312)
    at injectableDefOrInjectorDefFactory (core.js:13259)
    at providerToFactory (core.js:13297)
    at providerToRecord (core.js:13281)

With import 'core-js/es7/reflect'; to src/polyfills.ts and ng serve --prod


Error: Angular JIT compilation failed: '@angular/compiler' not loaded!
  - JIT compilation is discouraged for production use-cases! Consider AOT mode instead.
  - Did you bootstrap using '@angular/platform-browser-dynamic' or '@angular/platform-server'?
  - Alternatively provide the compiler with 'import "@angular/compiler";' before bootstrapping.
    at Ae (core.js.pre-build-optimizer.js:448)
    at Ge (core.js.pre-build-optimizer.js:869)
    at ze (core.js.pre-build-optimizer.js:866)
    at Function.get (core.js.pre-build-optimizer.js:20742)
    at ge (core.js.pre-build-optimizer.js:320)
    at e.processInjectorType (core.js.pre-build-optimizer.js:13161)
    at core.js.pre-build-optimizer.js:13179
    at core.js.pre-build-optimizer.js:13340
    at Array.forEach (<anonymous>)
    at va (core.js.pre-build-optimizer.js:13340)

@angular/compiler is already imported in the main.ts file before bootstrapping. Disabling buildOptimizer causes the app to run successfully.

🌍 Your Environment

Angular Version:



Angular CLI: 8.0.0-beta.4
Node: 10.14.2
OS: linux x64
Angular: 8.0.0-beta.6
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.14.0-beta.2
@angular-devkit/build-angular     0.14.0-beta.2
@angular-devkit/build-optimizer   0.14.0-beta.2
@angular-devkit/build-webpack     0.14.0-beta.2
@angular-devkit/core              8.0.0-beta.4
@angular-devkit/schematics        8.0.0-beta.4
@angular/cli                      8.0.0-beta.4
@ngtools/webpack                  8.0.0-beta.2
@schematics/angular               8.0.0-beta.4
@schematics/update                0.14.0-beta.4
rxjs                              6.4.0
typescript                        3.2.4
webpack                           4.29.5

Anything else relevant?

NgRx versions

    "@ngrx/effects": "^7.2.0",
    "@ngrx/entity": "^7.2.0",
    "@ngrx/schematics": "^7.2.0",
    "@ngrx/store": "^7.2.0",
    "@ngrx/store-devtools": "^7.2.0",

cc: @IgorMinar @kara @alxhub

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
gkalpakcommented, Mar 12, 2019

Thx for looking into it, @alexzuza! It sounds like this issue might not be uncommon, so it is probably a good idea to try and fix in ngcc too.

FYI, there are some ngcc-related fixes/improvements in-flight (#28963, #29092, #29119, #29209). I think it makes sense to get those in first and then investigating this one.

1reaction
brandonrobertscommented, Apr 22, 2019

These issues seem to be resolved as of the latest beta (8.0.0-beta.13). I’ve updated the repo and removed the workarounds.

https://github.com/brandonroberts/ngrx-ivy-runtime-error

Angular CLI: 8.0.0-beta.16
Node: 10.10.0
OS: darwin x64
Angular: 8.0.0-beta.13
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.0-beta.16
@angular-devkit/build-angular     0.800.0-beta.16
@angular-devkit/build-optimizer   0.800.0-beta.16
@angular-devkit/build-webpack     0.800.0-beta.16
@angular-devkit/core              8.0.0-beta.16
@angular-devkit/schematics        8.0.0-beta.16
@angular/@types                   <error>
@angular/cli                      8.0.0-beta.16
@angular/events                   <error>
@angular/rxjs                     <error>
@angular/source-map               <error>
@angular/typescript               <error>
@ngtools/webpack                  8.0.0-beta.16
@schematics/angular               8.0.0-beta.16
@schematics/update                0.800.0-beta.16
rxjs                              6.4.0
typescript                        3.4.4
webpack                           4.30.0
Read more comments on GitHub >

github_iconTop Results From Across the Web

NgRx Effects crashing Angular app with infinite loop
Every time you update, the effect will try to update again, and again, and again :P. To make this work, just remove countActionsType....
Read more >
Angular Debugging Tips and Tricks | All Front - AllFront.io
In this article, we'll cover some debugging tips and tricks we've learnt along the way. Tips for Debugging Angular Applications.
Read more >
The Complete Guide To Angular Load Time Optimization
In the past, I have written a lot about performance tuning Angular apps. Now it is time to dive into one of the...
Read more >
The NgRX store resets after a browser refresh in Angular (7 ...
Let's look at it logically. So you already have some information in your current state and now you want to persist that even...
Read more >
Angular Ngrx DevTools: Important Practical Tips
Another common source of hard to debug errors while building a store application is the possibility of some component in our component tree...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found