12

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

Kay
  • 17,906
  • 63
  • 162
  • 270

1 Answers1

26

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.

Neyxo
  • 710
  • 8
  • 19