2017-12-24 24 views
0

私はredux(ngrx)を使用してアプリケーションを作成しましたが、すべてがdevモードで正常に動作しますが、プロダクションビルドではAOTを使用していますので、エラーUncaught TypeError: Cannot convert undefined or null to object、 sourceはcombineReducersです。どのようにこれを解決することができます。修正プログラムは、ここにnrgxこのAOTコンパイル・エラーのために存在するNgrxの問題AOT with angle

// reducer.ts 

import { DynamicComponent, FieldTypeReducer, FormCreate, FormGroup, FormList, FormTemplates, FormPreview, FormView } from './forms'; 

const reducers = { 
    dynamicComponent: DynamicComponent, 
    fieldType: FieldTypeReducer, 
    formCreate: FormCreate, 
    formGroup: FormGroup, 
    formList: FormList, 
    formTemplates: FormTemplates, 
    formPreview: FormPreview, 
    formView: FormView 
}; 

export default reducers; 


// app.module.ts 
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; 

import { StoreDevtoolsModule } from '@ngrx/store-devtools'; 
import { StoreModule, ActionReducer, MetaReducer } from '@ngrx/store'; 

// Reducer 
import reducers from './reducer'; 


@NgModule({ 
    imports: [ 

    StoreModule.forRoot(reducers), 
    StoreDevtoolsModule.instrument({ 
     maxAge: 25 
    }) 
    ], 
    providers: [], 
    declarations: [ 
    AppComponent 
    ], 
    schemas: [CUSTOM_ELEMENTS_SCHEMA], 
    bootstrap: [AppComponent] 
}) 
export class AppModule { } 

答えて

関連する問題