Enlcxx / angular2-resizing-cropping-image

Resize, rotate and crop images(cropper) for Angular 8
https://alyle.io/components/image-cropper
32 stars 6 forks source link

Build fail with aot #6

Closed Silvercast closed 7 years ago

Silvercast commented 7 years ago

ng build --aot

ERROR in Unexpected value 'ResizingCroppingImagesComponent in /node_modules/angular2-resizing-cropping-image/resizing-cropping-images.component.d.ts' declared by the module 'AppBrowserModule in /src/app/app.browser.module.ts'. Please add a @Pipe/@Directive/@Component annotation.

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.browser.module.ngfactory' in 

it works without aot though. but we want aot...

hiraldesai commented 7 years ago

I have the same issue when running ng build --prod --aot, has anyone found a workaround/fix yet?

hiraldesai commented 7 years ago

Update: ng build on debug also fails with the most recent version of @angular/cli with this error ERROR in LyResizingCroppingImageModule is not an NgModule. It must be due to newer angular versions changing how modules are defined.

Frly commented 7 years ago

Now you can update the module, you can import the module separately as it is inside alyle-ui

# install the repo with npm
 npm install alyle-ui --save

ts

import {
  AlyleUIModule,
  LyResizingCroppingImageModule,
 } from 'alyle-ui';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    [...]
    AlyleUIModule.forRoot({
      primary: 'blue',
      accent: 'pink',
      other: 'red',
    }),
    LyResizingCroppingImageModule,
  ],
  bootstrap: [AppComponent]

html

<ly-cropping #Img format="png"></ly-cropping>