How to fix ReferenceError: globalThis is not defined
How to fix
To fix this error you need to be using a version of node12+ however this may not solve the error on some browsers.
Install the polyfill
I recommend adding a polyfill for globalThis to ensure that the error is fixed over every environment.
npm i globalthis
inside polyfill.js add the following line
or import it into your file using
var globalThis = require('globalthis/polyfill')();