Angular 6 Auth0-全局未定义 [英] Angular 6 Auth0 - global not defined

查看:47
本文介绍了Angular 6 Auth0-全局未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将我的应用程序从5号角升级到6号角.我现在收到以下错误.

Ive upgraded my app from angular 5 to angular 6. i get the following error now.

Uncaught ReferenceError: global is not defined
at Object../node_modules/auth0-lock/lib/utils/cdn_utils.js (cdn_utils.js:13)

"angular2-jwt":"^ 0.2.3","auth0-js":"^ 9.5.1","auth0-lock": "^ 11.6.1",

"angular2-jwt": "^0.2.3", "auth0-js": "^9.5.1", "auth0-lock": "^11.6.1",

推荐答案

在Angular CLI的版本6中,我们删除了global的填充程序,并且 其他节点内置.您可以阅读有关为何进行此更改的更多信息 在#9827 (评论)中.

On version 6 of Angular CLI we are removing the shim for global and other node built-ins. You can read more about why this change was made in #9827 (comment).

如果您使用的库假定存在这些全局变量,则您 可以尝试将其手动填充到polyfills.ts文件中:

If you are using a library that assumes these globals are present, you can try manually shimming it inside your polyfills.ts file:

// Add global to window, assigning the value of window itself. (window as any).global = window;

// Add global to window, assigning the value of window itself. (window as any).global = window;

添加该行可以解决您的错误.

Adding the line should resolve your error.

这篇关于Angular 6 Auth0-全局未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆