0

Updated from Angular 5 to 9. I got the following error in browser devtools:

Uncaught ReferenceError: global is not defined

I saw the following post addressing the issue:

Upgrading to angular-6.x gives "Uncaught ReferenceError: global is not defined"

So I tried to implement the accepted answer's solution and put the following script in my index.html file <head> tag:

  <script>
    var global = global || window;
    var Buffer = Buffer || [];
    var process = process || {
      env: { DEBUG: undefined },
      version: []
    };
  </script>

However, this gave the following error in browser devtools:

default-encoding.js:6 Uncaught TypeError: process.version.split is not a function

It seems like Angular didn't ship a implementation of process and Buffer to the frontend. Any suggestions how to fix this?

Willem van der Veen
  • 33,665
  • 16
  • 190
  • 155

1 Answers1

0

Via https://stackoverflow.com/a/50313953/976676:

This is an incompatibility with Angular v6. They removed support (shim) of process and global variables in browser.

For further clarification: https://github.com/angular/angular-cli/issues/9827#issuecomment-369578814

Friso Hoekstra
  • 845
  • 2
  • 9
  • 24