App working under 8.0.0-beta.2, upgrading to 8.0.0-rc.0 make serving the app fail with the following message:
ERROR in : Invalid provider for undefined. useClass cannot be undefined.
Usually it happens when:
1. There's a circular dependency (might be caused by using index.ts (barrel) files).
2. Class was used before it was declared. Use forwardRef in this case.
: Can't resolve all parameters for StoreRouterConnectingModule in /app/node_modules/@ngrx/router-store/router-store.d.ts: ([object Object], [object Object], ?, [object Object], [object Object]).
The app to work again ; the listed breaking changes don't seem like they should impact the ability to serve the app.
We use the following packages in 8.0.0-rc.0
@angular and its friends are all in ^8.0.0, node is 10.14.1.
[x] Yes (Assistance is provided if you need help submitting a pull request)
[ ] No
I would love to, but could not find the root cause so far.
Looking at https://github.com/ngrx/platform/compare/8.0.0-beta.2...8.0.0-rc.0, no change would obviously break our code, which make it look like a circular dependency got added when adding MinimalRouterStateSerializer.
Do you provide your own serializer by any chance @adrogon ?
Could you share your usage of StoreRouterConnectingModule.forRoot?
Broken either way, with serializer specified or with any routerState, e.g.
StoreRouterConnectingModule.forRoot({
routerState: RouterState.Full
})
BTW, it only affects AOT, JIT seems to be Ok, if I am not mistaken.
Will someone provide a small reproduction of the issue?
@Domratchev is correct, this happens when AOT is enabled.
@brandonroberts Here is a simple reproduction:
ng new repro && cd repro && ng update rxjs @angular/cli @angular/core && npm i @ngrx/[email protected] @ngrx/[email protected] --save
src/app/app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { StoreModule } from '@ngrx/store';
import { StoreRouterConnectingModule } from '@ngrx/router-store';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
StoreModule.forRoot({}),
StoreRouterConnectingModule.forRoot()
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
ng serve --aot
@brandonroberts @timdeschryver
I can confirm that issue. It only occurs in AOT. Had the same problem when activating the AOT flag.
There are two different issues.
'@ngrx/router-store':import { StoreRouterConnectingModule } from '@ngrx/router-store'; // @ngrx v8.0.0-rc.0
error:
ERROR in : Can't resolve all parameters for StoreRouterConnectingModule in /node_modules/@ngrx/router-store/router-store.d.ts: ([object Object], [object Object], ?, [object Object], [object Object]).
import { StoreRouterConnectingModule } from '@ngrx/router-store';
@NgModule({
declarations: [
AppComponent,
],
bootstrap: [
AppComponent,
],
imports: [
StoreRouterConnectingModule.forRoot({
routerState: RouterState.Minimal,
}),
})
export class AppModule { }
error:
Invalid provider for undefined. useClass cannot be undefined.
Usually it happens when:
1. There's a circular dependency (might be caused by using index.ts (barrel) files).
2. Class was used before it was declared. Use forwardRef in this case.
Repro: https://github.com/timdeschryver/sandbox-version-eight
Weird that the example-app didn't caught this, my guess is that this is because it has @ngrx/router-store set as a path.
I'm getting the same error with 8.0.0-beta.0, 8.0.0-beta.1, 8.0.0-beta.2 and 8.0.0-rc.0 on build. Currently I'm using 7.4.0, but it also has its issues (I have opened an issue https://github.com/ngrx/platform/issues/1905)
@DenisSemionov the fix for this issue hasn't been released yet.
You can install it from our nightlies
Most helpful comment
@DenisSemionov the fix for this issue hasn't been released yet.
You can install it from our nightlies