角度 6 Auth0 - 全局未定义



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

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",

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

在 Angular CLI 的第 6 版上,我们正在移除global和 其他节点内置。您可以阅读有关进行此更改的原因的更多信息 在#9827(评论(中。

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

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

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

最新更新