AngularFireStorage - TypeError:只能在prod

时间:2018-02-23 05:04:32

标签: firebase firebase-storage angularfire google-cloud-firestore angular5

当我使用AngularFireStorage时,我在ng build --prod时遇到此错误,dev(ng build)中没有错误: enter image description here

main.8afd3376565525d9bdde.bundle.js:1 
ERROR TypeError: Cannot read property 'apply' of undefined
    at e.project (main.8afd3376565525d9bdde.bundle.js:1)
    at e._next (main.8afd3376565525d9bdde.bundle.js:1)
    at e.next (main.8afd3376565525d9bdde.bundle.js:1)
    at e._next (main.8afd3376565525d9bdde.bundle.js:1)

版本信息

Angular:5.1.0 火力地堡:4.9.0 AngularFire:5.0.0-rc.6 zone.js:0.8.19 节点:8.3.0,

如何重现:

我正在使用官方文档上传文档。 (https://github.com/angular/angularfire2/blob/master/docs/storage/storage.md

import { Component } from '@angular/core';
import { AngularFireStorage } from 'angularfire2/storage';

@Component({
  selector: 'app-root',
  template: `
  <input type="file" (onchange)="uploadFile($event)">
  `
})
export class AppComponent {
  constructor(private storage: AngularFireStorage) { }
  uploadFile(event) {
    const file = event.target.files[0];
    const filePath = 'name-your-file-path-here';
    const task = this.storage.upload(filePath, file);
  }
}

我在主模块中导入AngularFireStorageModule

import { AngularFireStorageModule } from 'angularfire2/storage';

错误来自AngularFireStorage,因为当我不导入AngularFireStorage时,我没有错误。

constructor(
    // private storage: AngularFireStorage
) { }

仅供参考,这里有代码被阻止的地方。 enter image description here

0 个答案:

没有答案