无法找到模块' @ firebase / storage-types'

时间:2018-02-01 23:28:39

标签: typescript firebase

我有一个非常简单的TypeScript文件:

import { Reference } from "@firebase/storage-types";

export interface IReference extends Reference {
  getMetadata<T = any>(): Promise<T>;
  getDownloadURL(): Promise<string>;
}

export {
  FullMetadata as IFullMetadata,
  SettableMetadata as ISettableMetadata,
  UploadMetadata as IUploadMetadata,
  UploadTask as IUploadTask,
  UploadTaskSnapshot as IUploadTaskSnapshot,
  FirebaseStorage
} from "@firebase/storage-types";

这转化为以下Javascript:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var storage_types_1 = require("@firebase/storage-types");
exports.FirebaseStorage = storage_types_1.FirebaseStorage;

有趣的是,当我使用node lib/storage.js运行它时,它失败了:

  

错误:无法找到模块&#39; @ firebase / storage-types&#39;

包含此模块作为依赖项。这是完整的块:

  "dependencies": {
    "@firebase/app-types": "^0.1.1",
    "@firebase/auth-types": "^0.1.1",
    "@firebase/database-types": "^0.1.1",
    "@firebase/firestore-types": "^0.2.1",
    "@firebase/messaging-types": "^0.1.1",
    "@firebase/storage-types": "^0.1.1",
    "@firebase/util": "^0.1.7"
  },

但是,如果我代理导出到容器而更改名称 - 就像我正在使用FirebaseStorage那样 - 那么这导致require语句无法解析。

我该如何避免这种情况?

0 个答案:

没有答案