I\'m getting following error when I build the Angular app using \"ng build --prod\". This is working when I build with Angular 4 and getting error with Angular 5. With Angul
In my case, I had a pipe declared as their own class in mypipe.ts
as well as in app.component.ts
for some reason. I remove the one in app.component and it compiled fine.
In the error message, check where exactly it is complaining and see if that is double code in your project.
Check Case Sensitivity
import { MyComponent } from "./User/my-component";
In my case, the problem was that the folder user was created with U as capital in my import statement. But actually on disk it was in small case. When I renamed the folder to user (with u lower case) in my import statement also, it worked for me.
import { MyComponent } from "./user/my-component";
So check the case sensitivity, of your import path.
for me, the problem was in case sensitive in import paths. but you must find all imports path that have problem. not only import that used in your module.
I also faced same error only on prod build but not on dev build. I imported component.ts file in app.module.ts but didn't used in NgModule. So I removed the import, it worked fine.
Normally this error occurred when you created a component but not imported it to any module.