Type ImageCropperComponent is part of the declarations of 2 modules...
AmirGilboa opened this issue · 5 comments
in angular 4 project, created with cli, i have added angular2-img-cropper.
ng serve works fine, but ng build -aot -prod produces this error:
[1] ERROR in Error: Type ImageCropperComponent in
D:/Projects/Angular2/projectX/node_modules/ng2-img-cropper/src/imageCropperComponent.d.ts
is part of the declarations of 2 modules:
ImageCropperModule in D:/Projects/Angular2/projectX/node_modules/ng2-img-cropper/src/imageCropperModule.d.ts
and AppModule in D:/Projects/Angular2/projectX/client/app/app.module.ts!
Please consider moving ImageCropperComponent in
D:/Projects/Angular2/projectX/node_modules/ng2-img-cropper/src/imageCropperComponent.d.ts
to a higher module that imports ImageCropperModule in
D:/Projects/Angular2/projectX/node_modules/ng2-img-cropper/src/imageCropperModule.d.ts
and
AppModule in D:/Projects/Angular2/projectX/client/app/app.module.ts.
You can also create a new NgModule that exports and includes ImageCropperComponent in
D:/Projects/Angular2/projectX/node_modules/ng2-img-cropper/src/imageCropperComponent.d.ts
then import that NgModule in ImageCropperModule in
D:/Projects/Angular2/projectX/node_modules/ng2-img-cropper/src/imageCropperModule.d.ts
and
AppModule in
D:/Projects/Angular2/projectX/client/app/app.module.ts.
Any idea?
I think you have to import ImageCropperModule instead of declaring ImageCropperComponent in your app.module.ts
it is imported, not declared.
I would love to see a working angular 4 app or demo, that passes all stages including production.
that would eliminate the guesswork.
thanks.
It works for us.
We imported the ImageCropperModule into our shared module, wich is imported in serveral modules.
you imported the ICComponent not the ICModule - at least that is what the error report says:
...is part of the declarations of 2 modules:
...and AppModule in D:/Projects/Angular2/projectX/client/app/app.module.ts!
this repo is deprecated. But this comp will be maintained by me at https://github.com/web-dave/ngx-img-cropper