在Angular2-cli应用程序中使用GeoFire,该应用程序使用WebPack而不是System.config.j



我是打字稿的新手,面对这个问题,这个问题的答案在另一个问题中完美地给出,但我不知道如何在 web pack 中做到这一点,因为提供给该答案的解决方案是 System.config.js 而且我的项目中没有它。这是该问题的链接,如果可以解决System.config.js部分。

在 Angular2 应用程序中使用 GeoFire

遇到了同样的问题并使用 webpack 暴露加载器解决了它:

公开加载程序

首先将其添加到您的捆绑包 (vendor.ts):

require("expose?GeoFire!geofire");

然后将其添加到 webpack.config 中的加载器中.js:

module: {
  loaders: [
    { test: require.resolve('geofire'), loader: 'expose?GeoFire' }
  ]
}

最后在您的组件中:

declare var GeoFire: any;

相关内容

最新更新