Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 6 Auth0 - global not defined

Tags:

angular

auth0

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

like image 228
Kay Avatar asked May 07 '18 07:05

Kay


1 Answers

There was a similar issue in this angular thread:

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).

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;

Adding the line should resolve your error.

like image 147
Neyxo Avatar answered Sep 19 '22 09:09

Neyxo