Error: Unexpected value 'undefined' imported by the module

前端 未结 30 1863
礼貌的吻别
礼貌的吻别 2020-12-01 03:51

I\'m getting this error after migrating to NgModule, the error doesn\'t help too much, any advice please?

Error: Error: Unexpected value \'undefined\' import         


        
30条回答
  •  一向
    一向 (楼主)
    2020-12-01 04:49

    Another reason could be some code like this:

    import { NgModule } from '@angular/core';
    import { SharedModule } from 'app/shared/shared.module';
    import { CoreModule } from 'app/core/core.module';
    import { RouterModule } from '@angular/router';
    import { COMPANY_ROUTES } from 'app/company/company.routing';
    import { CompanyService } from 'app/company/services/company.service';
    import { CompanyListComponent } from 'app/company/components/company-list/company-list.component';
    
    @NgModule({
        imports: [
            CoreModule,
            SharedModule,
    		RouterModule.forChild(COMPANY_ROUTES)
        ],
        declarations: [
    		CompanyListComponent
        ],
        providers: [
    		CompanyService
        ],
        exports: [
        ]
    })
    export class CompanyModule { }

    Because exports is empty array and it has , before it, it should be removed.

提交回复
热议问题