Thursday, December 19, 2019

When I spun up an Angular 8 application today and tried to add providers to AppModule a series of errors appeared at the console requiring doctor-ups to polyfills.ts as a remedy.

Uncaught ReferenceError: global is not defined

To get past this first, I added this to polyfills.ts at the top:

(window as any).global = window;

 
 

Uncaught ReferenceError: Buffer is not defined

To get past this next, I expanded upon what I put in polyfills.ts like so:

(window as any).global = window;
(window as any).Buffer = {};

 
 

Uncaught ReferenceError: process is not defined

To get past this third in order and second to last, I expanded upon what I put in polyfills.ts like so:

(window as any).global = window;
(window as any).Buffer = {};
(window as any).process = {
   env: { DEBUG: undefined }
};

 
 

Uncaught TypeError: Cannot read property 'slice' of undefined

To get past this lastly, I expanded upon what I put in polyfills.ts like so:

(window as any).global = window;
(window as any).Buffer = {};
(window as any).process = {
   env: { DEBUG: undefined },
   version: []
};

No comments:

Post a Comment