Angular 6 Auth0 - 全局未定义

Kay*_*Kay 12 auth0 angular

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

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

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

Ney*_*yxo 25

这个角度线程中存在类似的问题:

在Angular CLI的第6版中,我们删除了shim for global和其他节点内置函数.您可以在#9827(评论)中详细了解此更改的原因.

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

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

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