[solved] `ionic build --prod` Can't resolve all parameters for RestyService in ./src/app/providers/resty.service.ts: (?, ?)


#1

dev build works just fine, but when I try a prod build I get this error:

Can't resolve all parameters for RestyService in ./src/app/providers/resty.service.ts: (?, ?)

not sure where to look, but here is what I have for the provider

export class RestyService<T> {


  constructor(data:Array<T>=[], className?:string) {
    this._data = data.reduce( (res, o:T)=>{
      const uuid = o['uuid'] || quickUuid();
      res[uuid] = Object.assign({uuid}, o, {uuid});
      return res;
    },{});
    this.className = className || "_unknown_";
  }

}

and in the

@NgModule({
  declarations: [AppComponent,
  ],
  exports: [
    AppComponent,
  ],
  entryComponents: [],
  imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule,],
  providers: [
    StatusBar,
    SplashScreen,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
    RestyService, 
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

ionic info


Ionic:

   ionic (Ionic CLI)             : 4.3.1 (/Users/m/.nvm/versions/node/v8.9.4/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.0-beta.15
   @angular-devkit/build-angular : 0.8.7
   @angular-devkit/schematics    : 0.8.7
   @angular/cli                  : 7.0.5
   @ionic/angular-toolkit        : 1.1.0

Capacitor:

   capacitor (Capacitor CLI) : 1.0.0-beta.7
   @capacitor/core           : 1.0.0-beta.7

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : none
   Cordova Plugins       : no whitelisted plugins (0 plugins total)

System:

   ios-deploy : 2.0.0
   NodeJS     : v8.9.4 (/Users/m/.nvm/versions/node/v8.9.4/bin/node)
   npm        : 6.4.1
   OS         : macOS High Sierra
   Xcode      : Xcode 10.0 Build version 10A255

#2

[SOLVED] the problem was something else.

I had declared the service Injectable but I never injected it anywhere.

@Injectable({
  providedIn: 'root'
})
export class RestyService<T> {
}
``

I just imported and used `new RestyService()`. This was never a problem until I tried to build `--prod`