Recently, interpreter.js was modified to do the following:
Interpreter.nativeGlobal = this;
The problem is that things like RegExp are now broken if interpreter.js is imported using code like:
import { Interpreter } from '[your path to interpreter.js]'
This could be fixed by changing nativeGlobal to use globalThis if it exists, like:
Interpreter.nativeGlobal = typeof globalThis === 'undefined' ? this : globalThis;
(Since most projects that would use import will likely support globalThis, that seems like the simplest way to solve it. Otherwise, checking for globalThis, self, window, then global would be the more complete solution.)
Recently, interpreter.js was modified to do the following:
The problem is that things like RegExp are now broken if interpreter.js is imported using code like:
This could be fixed by changing nativeGlobal to use globalThis if it exists, like:
(Since most projects that would use import will likely support globalThis, that seems like the simplest way to solve it. Otherwise, checking for
globalThis
,self
,window
, thenglobal
would be the more complete solution.)