version
Angular CLI: 12.0.2
Node: 14.17.0
Package Manager: npm 6.14.13
OS: win32 x64
Angular: 12.0.2
... cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1201.2
@angular-devkit/build-angular 12.0.2
@angular-devkit/core 12.1.2
@angular-devkit/schematics 12.0.2
@schematics/angular 12.0.2
rxjs 6.6.6
typescript 4.2.4
on ng serve, the following happens
runtime.js:1 Uncaught ReferenceError: global is not defined
at runtime.js:1
at runtime.js:1
at runtime.js:1
(anonymous) @ runtime.js:1
(anonymous) @ runtime.js:1
(anonymous) @ runtime.js:1
polyfills.js:1 Uncaught ReferenceError: global is not defined
at polyfills.js:1
(anonymous) @ polyfills.js:1
styles.js:1 Uncaught ReferenceError: global is not defined
at styles.js:1
(anonymous) @ styles.js:1
main.js:1 Uncaught ReferenceError: global is not defined
at main.js:1
Here's how I've tried
- polyfills.ts
(window as any).global = window;
- add new file and put the line (global-shim.ts)
(window as any).global = window;
polyfills.ts
import 'global-shim';
not all work. how can i solve it?