加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

aws-sdk:从angular5更新为angular6后崩溃

发布时间:2020-12-17 18:00:15 所属栏目:安全 来源:网络整理
导读:我刚从Angular 5.2更新到Angular 6.0,我的代码现在突破了这个错误: core.js:1601 ERROR Error: Uncaught (in promise): ReferenceError: global is not definedReferenceError: global is not definedat Object../node_modules/buffer/index.js (index.js:4
我刚从Angular 5.2更新到Angular 6.0,我的代码现在突破了这个错误:

core.js:1601 ERROR Error: Uncaught (in promise): ReferenceError: global is 
not defined
ReferenceError: global is not defined
at Object../node_modules/buffer/index.js (index.js:43)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/aws-sdk/lib/browserHashUtils.js 
(browserHashUtils.js:1)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/aws-sdk/lib/browserHmac.js (browserHmac.js:1)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/aws-sdk/lib/browserCryptoLib.js 
(browserCryptoLib.js:1)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/aws-sdk/lib/browser_loader.js (browser_loader.js:4)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/buffer/index.js (index.js:43)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/aws-sdk/lib/browserHashUtils.js 
(browserHashUtils.js:1)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/aws-sdk/lib/browserHmac.js (browserHmac.js:1)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/aws-sdk/lib/browserCryptoLib.js 
(browserCryptoLib.js:1)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/aws-sdk/lib/browser_loader.js (browser_loader.js:4)
at __webpack_require__ (bootstrap:81)

有人知道这个问题吗?
我尝试过更新,但似乎aws-sdk-js不提供更新的原理图

解决方法

将以下内容添加到polyfills.ts中

// aws-sdk requires global to exist
(window as any).global = window;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读