alxhub / io17

106 stars 21 forks source link

AngularFireDatabaseModule and ng-pwa-tools #18

Closed MichaelSolati closed 7 years ago

MichaelSolati commented 7 years ago

I've been trying to use angularfire2 with the ng-pwa-tools, but when I get to the using the ngu-app-shell tool or the ngu-sw-manifest I have the following error.

> my-cool-site@0.0.0 ngu-app-shell /Users/michaelsolati/Documents/workspace/my-cool-site
> ngu-app-shell --module src/app/app.module.ts --out dist/index.html

/Users/michaelsolati/Documents/workspace/my-cool-site/node_modules/@angular/compiler/bundles/compiler.umd.js:1724
    var /** @type {?} */ error = Error(msg);
                                 ^
Error: Unexpected value 'undefined' imported by the module 'SharedModule'
    at syntaxError (/Users/michaelsolati/Documents/workspace/my-cool-site/node_modules/@angular/compiler/bundles/compiler.umd.js:1724:34)
    at /Users/michaelsolati/Documents/workspace/my-cool-site/node_modules/@angular/compiler/@angular/compiler.es5.js:15384:27
    at Array.forEach (native)
    at CompileMetadataResolver.getNgModuleMetadata (/Users/michaelsolati/Documents/workspace/my-cool-site/node_modules/@angular/compiler/@angular/compiler.es5.js:15361:42)
    at CompileMetadataResolver.getNgModuleSummary (/Users/michaelsolati/Documents/workspace/my-cool-site/node_modules/@angular/compiler/@angular/compiler.es5.js:15303:10)
    at /Users/michaelsolati/Documents/workspace/my-cool-site/node_modules/@angular/compiler/@angular/compiler.es5.js:15376:65
    at Array.forEach (native)
    at CompileMetadataResolver.getNgModuleMetadata (/Users/michaelsolati/Documents/workspace/my-cool-site/node_modules/@angular/compiler/@angular/compiler.es5.js:15361:42)
    at CompileMetadataResolver.getNgModuleSummary (/Users/michaelsolati/Documents/workspace/my-cool-site/node_modules/@angular/compiler/@angular/compiler.es5.js:15303:10)
    at /Users/michaelsolati/Documents/workspace/my-cool-site/node_modules/@angular/compiler/@angular/compiler.es5.js:15376:65

I'm pretty sure I'm going through the angularfire2 set up correctly as it works perfectly fine when I'm testing/developing/building. It's just with the ng-pwa-tools these errors pop up.


Module

@NgModule({
  imports: [
    AngularFireModule.initializeApp(environment.firebase),
    AngularFireDatabaseModule
  ],
  declarations: [],
  providers: [ CoolService ],
  exports: []
})
export class SharedModule {
  constructor(private _cs: CoolService) { }

  static forRoot(): ModuleWithProviders {
    return { ngModule: SharedModule };
  }
}

Service

@Injectable()
export class CoolService {
  private _cool: Observable<any[]>;
  constructor(private _afd: AngularFireDatabase) {
    this._cool = this._afd.list('/cool');
  }
  get cool(): Observable<any[]> {
    return this._cool;
  }
}
MichaelSolati commented 7 years ago

Closing as it seems to be related and being addressed by https://github.com/angular/angularfire2/issues/1073