Error: Unexpected value 'undefined' imported by the module
For anyone facing this same error, my situation was that I have double commas in the imports section
imports: [
BrowserModule,
HttpModule,
FormsModule,
RouterModule.forRoot(appRoutes), , // <-- this was the error
// ....
],
Make sure the modules don't import each other. So, there shouldn't be
In Module A: imports[ModuleB]
In Module B: imports[ModuleA]
This can be caused by multiple scenarios like
- Missing commas
imports: [
BrowserModule
,routing <= Missing Comma
,FeatureComponentsModule
],
- Double Commas
imports: [
BrowserModule,
,routing <=Double Comma
,FeatureComponentsModule
],
- Exporting Nothing from the Module
- Syntax errors
- Typo Errors
- Semicolons inside Objects, Arrays
- Incorrect import Statements
I had the same problem. In my case, the reason is an extra comma.