zyra/ionic-image-loader

ionic v4 --prod flag getting an error

gaurav-chandra opened this issue · 1 comments

ERROR Error: StaticInjectorError(e)[t]: 
  StaticInjectorError(Platform: core)[t]: 
    NullInjectorError: No provider for t!
    at e.get (main.260e9c4eb705ed3dca6d.js:1)
    at main.260e9c4eb705ed3dca6d.js:1
    at e (main.260e9c4eb705ed3dca6d.js:1)
    at e.get (main.260e9c4eb705ed3dca6d.js:1)
    at main.260e9c4eb705ed3dca6d.js:1
    at e (main.260e9c4eb705ed3dca6d.js:1)
    at e.get (main.260e9c4eb705ed3dca6d.js:1)
    at c_ (main.260e9c4eb705ed3dca6d.js:1)
    at e.get (main.260e9c4eb705ed3dca6d.js:1)
    at Et (main.260e9c4eb705ed3dca6d.js:1)

the above error is generated when using --prod flag. But works fine if not using --prod.

NOTE I am using this in a shared module which is included where I need to use the image loader

Read the new v4 readme and found the problem. I did not import the WebView in app.module.ts.

This code helped me:

import { IonicImageLoader } from 'ionic-image-loader';
import { WebView } from '@ionic-native/ionic-webview/ngx';

// import the module
@NgModule({
  ...
  imports: [
    IonicImageLoader.forRoot()
  ],
  providers: [
      WebView
  ]
})
export class AppModule {}