cstefanache / angular2-img-cropper

Angular 2 Image Cropper
MIT License
364 stars 135 forks source link

Type ImageCropperComponent is part of the declarations of 2 modules... #279

Closed AmirGilboa closed 6 years ago

AmirGilboa commented 6 years ago

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?

centigradeclemensP commented 6 years ago

I think you have to import ImageCropperModule instead of declaring ImageCropperComponent in your app.module.ts

AmirGilboa commented 6 years ago

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.

web-dave commented 6 years ago

It works for us. We imported the ImageCropperModule into our shared module, wich is imported in serveral modules.

centigradeclemensP commented 6 years ago

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!

web-dave commented 6 years ago

this repo is deprecated. But this comp will be maintained by me at https://github.com/web-dave/ngx-img-cropper