Zen*_*aro 7 amazon-web-services typescript aws-sdk angular
我刚从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)
Run Code Online (Sandbox Code Playgroud)
有人知道这个问题吗?我尝试过更新,但似乎aws-sdk-js不提供更新的原理图
小智 15
将以下内容添加到polyfills.ts中
// aws-sdk requires global to exist
(window as any).global = window;
Run Code Online (Sandbox Code Playgroud)
在解决此问题之前有一个解决方法,
尝试在您的 index.html head 标签中添加以下内容
<script>
if (global === undefined) {
var global = window;
}
</script>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1970 次 |
| 最近记录: |