Uncaught ReferenceError: global is not defined
I used the ngx-mask normally but in a new deployment was updated the version and now I have this error
ngx-mask.js:1469 Uncaught ReferenceError: global is not defined
at ngx-mask.js:1469
at Module../node_modules/ngx-mask/__ivy_ngcc__/fesm2015/ngx-mask.js (ngx-mask.js:1472)
at __webpack_require__ (bootstrap:79)
at Module../src/app/components/add-or-edit-bundle/add-or-edit-bundle.component.ts (add-or-edit-bundle.component.ts:1)
at __webpack_require__ (bootstrap:79)
at Module../src/app/app-routing.module.ts (app-routing.module.ts:1)
at __webpack_require__ (bootstrap:79)
at Module../src/app/app.module.ts (app.module.ts:1)
at __webpack_require__ (bootstrap:79)
at Module../src/main.ts (main.ts:1)
And locally trying to replicate the error I delete package-lock.json and node_modules folder and the same error
If someone knows the solution please let me know and thanks.
Sup bro, look, I don't know how contribute because I don't know none o f this about contributing on a project, but the solution it's kinda simple, just go to your "node_modules/ngx-mask/ivy_ngcc/fesm2015/ngx-mask.js" (I'm using Angular 9, so Ivy, you know) and change this lines in the code
from this

to this

I don't know much about Nodejs world but Javascript, and I know globalThis represent the same global object client-side and server-side.
I hope someone see this and contribute making a PR if this is the right solution, it works for me and hope this works for you too, but I had to added directly to my project so my folks don't need to make this changes manually :)
I have the same error. Angular 10.0.9. Still looking for a definitive solution.
https://github.com/angular/angular-cli/issues/9827#issuecomment-369578814 - explanation why 'global is not defined' in browser
I can`t figured out why demo app in project repo is working normally! Maybe one of the installed package defined 'global'
Any way, in my opinion the @Devrax solution witn globalThis is good. But globalThis is not support by IE (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis)
I think the issue should be solved on ngx-mask lib level, but as a temporary solution, you can write this in your project polyfill.ts file (window as any).global = window;
@hernanyarbi @treiero @asnow73 @Devrax Thank you for discussion . Please try v 10.0.4