我在Angular Build(ng build --prod)期间遇到此错误:
错误:模块'SharedModule'导出了意外的值'null'
@NgModule({
declarations: [InputComponent, InputSimpleComponent, ModelEditComponent,
ModelEditSaveButtonComponent, ModelSelectTableHeaderComponent,
ModelEditActionsComponent, ModelSelectTableBodyComponent,
ModelSelectTablePageComponent, ModelSelectTopComponent,
ModelSelectTableComponent, ModelSelectFilterComponent,
ModelSelectFilterSearchButtonComponent,
MakesAutocompleteComponent, ModelsAutocompleteComponent,
VersionsAutocompleteComponent,
VersionsYearsAutocompleteComponent,
StatusAutocompleteComponent, FormsAutocompleteComponent,
BannersGroupAutocompleteComponent,
BannersStatusAutocompleteComponent,
EntitiesAutocompleteComponent,
MetaDatasGroupsAutocompleteComponent,
ContentsGroupAutocompleteComponent,
ContentsTypeAutocompleteComponent/*,
ModelSelectTableRowComponent*/],
imports: [FormsModule, ReactiveFormsModule, CommonModule,
MatAutocompleteModule, MatInputModule],
exports: [InputComponent, InputSimpleComponent, FormsModule,
ReactiveFormsModule, CommonModule, ModelEditComponent,
ModelEditSaveButtonComponent, ModelSelectTableHeaderComponent,
ModelEditActionsComponent, ModelSelectTableBodyComponent,
ModelSelectTablePageComponent, ModelSelectTopComponent,
ModelSelectTableComponent, ModelSelectFilterComponent,
ModelSelectFilterSearchButtonComponent, MakesAutocompleteComponent,
ModelsAutocompleteComponent, VersionsAutocompleteComponent,
VersionsYearsAutocompleteComponent, MatAutocompleteModule,
MatInputModule, StatusAutocompleteComponent,
FormsAutocompleteComponent, BannersGroupAutocompleteComponent,
BannersStatusAutocompleteComponent, EntitiesAutocompleteComponent,
MetaDatasGroupsAutocompleteComponent,
ContentsGroupAutocompleteComponent,
ContentsTypeAutocompleteComponent/*,
ModelSelectTableRowComponent*/]})
export class SharedModule {}
在开发版本期间可以正常运行:
ng build --configuration = development
但是错误发生在生产构建期间:
ng build --configuration = production OR ng build --prod
我找到的最接近的解决方案是这个:
ng build --prod --aot = false --build-optimizer = false
但是,这些选项会禁用Angular构建优化:/
我正在使用Angular 6.0.1 / Angular CLI 6.0.8。我已经搜索过,但没有找到明确的答案。有人可以帮我吗?
答案 0 :(得分:1)
当我遇到同样的错误时:
export default class SomeComponent {...}
将其更改为:
export class SomeComponent {...}
已解决了问题