【问题标题】:@ngrx/store@11.0.0 Error during template compile of 'StoreModule'@ngrx/store@11.0.0 'StoreModule' 模板编译期间出错
【发布时间】:2021-02-13 16:24:50
【问题描述】:

所以我今天早上将@ngrx 更新为最新版本:

-   "@ngrx/effects": "10.1.2",
-   "@ngrx/router-store": "10.1.2",
-   "@ngrx/store": "10.1.2",
+   "@ngrx/effects": "11.0.0",
+   "@ngrx/router-store": "11.0.0",
+   "@ngrx/store": "11.0.0",

@angular/core 之前已经迁移到@^11.0.0,一切都与@ngrx/store@10.1.2 配合得很好。当然,尽管peerDependency 无效。

现在我的构建 (ng build [PROJECT_NAME]) 遇到了抛出错误:

An unhandled exception occurred: @ngrx/store/ngrx-store.ts(224,21): Error during template compile of 'StoreModule'
  Expression form not supported.
@ngrx/store/ngrx-store.ts(231,15): Error during template compile of 'StoreModule'
  Expression form not supported.
@ngrx/store/ngrx-store.ts(257,13): Error during template compile of 'StoreModule'
  Expression form not supported.
@ngrx/store/ngrx-store.ts(224,21): Error during template compile of 'StoreModule'
  Expression form not supported.
@ngrx/store/ngrx-store.ts(231,15): Error during template compile of 'StoreModule'
  Expression form not supported.
@ngrx/store/ngrx-store.ts(257,13): Error during template compile of 'StoreModule'
  Expression form not supported.

我已经发现,原因与我在子模块中导入的StoreModule.forFeature('auth', reducers) 有关。根AppModule 导入StoreModule.forRoot(reducers, { metaReducers }),。我真的找不到错误,功能缩减器组合如下:

export interface AuthStateData {
  status: fromAuth.AuthStateData;
  loginPage: fromLoginPage.LoginStateData;
}

export const reducers: ActionReducerMap<AuthStateData> = {
  status: fromAuth.reducer,
  loginPage: fromLoginPage.reducer
};

有没有人遇到过类似的问题?并在最好的情况下找到解决方案?

不,(很遗憾)我的代码不是开源的。

【问题讨论】:

标签: angular typescript ngrx ngrx-store angular11


【解决方案1】:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-12-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多