angular2-img-cropper icon indicating copy to clipboard operation
angular2-img-cropper copied to clipboard

ng build -prod error

Open LyricTian opened this issue 8 years ago • 9 comments

ERROR in Type ImageCropperComponent in /Users/lyric/VSProjects/angular-operpf/node_modules/ng2-img-cropper/src/imageCropperComponent.ts is part of the declarations of 2 modules: ImageCropperModule in /Users/lyric/VSProjects/angular-operpf/node_modules/ng2-img-cropper/src/imageCropperModule.ts and AdminModule in /Users/lyric/VSProjects/angular-operpf/src/app/admin/admin.module.ts! Please consider moving ImageCropperComponent in /Users/lyric/VSProjects/angular-operpf/node_modules/ng2-img-cropper/src/imageCropperComponent.ts to a higher module that imports ImageCropperModule in /Users/lyric/VSProjects/angular-operpf/node_modules/ng2-img-cropper/src/imageCropperModule.ts and AdminModule in /Users/lyric/VSProjects/angular-operpf/src/app/admin/admin.module.ts. You can also create a new NgModule that exports and includes ImageCropperComponent in /Users/lyric/VSProjects/angular-operpf/node_modules/ng2-img-cropper/src/imageCropperComponent.ts then import that NgModule in ImageCropperModule in /Users/lyric/VSProjects/angular-operpf/node_modules/ng2-img-cropper/src/imageCropperModule.ts and AdminModule in /Users/lyric/VSProjects/angular-operpf/src/app/admin/admin.module.ts.

ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/Users/lyric/VSProjects/angular-operpf/src' @ ./src/main.ts 6:0-74 @ multi ./src/main.ts

LyricTian avatar Apr 01 '17 07:04 LyricTian

Can you please check against 0.8.6 && also check this issue: #152

cstefanache avatar Apr 04 '17 14:04 cstefanache

Any news on the issue?

cstefanache avatar Apr 07 '17 05:04 cstefanache

same problem for me - with version 0.8.6. "ng build" works, "ng build -p" throws the error above.

I also tried to remove the ImageCropperComponent from the ImageCropperModule (like https://github.com/cstefanache/angular2-img-cropper/issues/#126#issuecomment-283909666 did), but this didn't work either...

geraldhe avatar Apr 14 '17 06:04 geraldhe

@geraldhe, take a look here https://github.com/cstefanache/angular2-img-cropper/issues/126#issuecomment-276027945

franzus5 avatar Apr 15 '17 14:04 franzus5

yes, that worked. thanks a lot for the really useful module!

geraldhe avatar Apr 16 '17 21:04 geraldhe

Iam using it for Ionic. I am using 'ImageCropperComponent' in 'app.module.ts' and then in 'crop-image.ts'. In app.module, I am importing it and adding it to Declarations. In crop-image, I am almost using a copied version of the Git example.

Everything working, if I am not using it for production --prod. Please help, where do I need to make changes.

yesprasoon avatar May 06 '17 20:05 yesprasoon

I have the same issue on version 0.9.0

danielebeneduci avatar Jul 11 '17 09:07 danielebeneduci

I sorted this out by doing following:

  • Do NOT use import {ImageCropperComponent} from 'ng2-img-cropper'; in module.ts
  • Use import {ImageCropperModule} from "ng2-img-cropper/index"; instead
  • Use import { ImageCropperComponent, CropperSettings } from 'ng2-img-cropper'; in crop page according to usage
  • Use npm install if needed

yesprasoon avatar Jul 11 '17 09:07 yesprasoon

Not working for me i did same thing but no success. Plz help me.

anilthakur29 avatar Aug 21 '17 08:08 anilthakur29