Error: Unexpected value 'undefined' imported by the module

前端 未结 30 1624
礼貌的吻别
礼貌的吻别 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:32

    I had this error because I had an index.ts file in the root of my app that was exporting my app.component.ts. So I thought I could do the following:

    import { AppComponent } from './';
    

    This worked and gave me no red squiggly lines and even intellisense brings up AppComponent when you start typing it. But come to find out it was causing this error. After I changed it to:

    import { AppComponent } from './app.component';
    

    The error went away.

提交回复
热议问题