Aurelia-Fetch 是否依赖于 whatwg-fetch?

Does Aurelia-Fetch have a dependency on whatwg-fetch?

我正在尝试将我的 Aurelia 项目从测试版升级到三月版。

我遇到的错误之一是:

Cannot find name 'Request'.

谷歌搜索在 GitHub 上提出了这个问题:https://github.com/aurelia/fetch-client/issues/65

这个问题说 "fix" 是为 whatwg-fetch 安装打字稿定义。当我安装这些打字稿定义时,错误消失了。

但这是否意味着我也需要 whatwg-fetch(查看我的 node_modules 文件夹,未安装 whatwg-fetch。)

aurelia-fetch-client 包装 Fetch APIwahtwg-fetch 是一个 Fetch polyfill,因此 fetch 客户端依赖于 polyfill 是没有意义的。此外,您将使用哪个 polyfill 取决于您使用的模块加载器。

基于

JSPM/SystemJS 的应用程序使用来自 GitHub 的 fetch polyfill,而大多数其他模块加载器使用 whatwg-fetch.

所以是的,您需要安装 whatwg-fetch,但 aurelia-fetch-client 不依赖于它是有充分理由的。