You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error: Uncaught (in worker "") (in promise) ReferenceError: self is not defined
at Object.<anonymous> (file:///Users/oscarotero/Library/Caches/deno/npm/registry.npmjs.org/prismjs/1.29.0/prism.js:11:48)
Looks like the self object is not defined inside Prism npm package. It's accessed here:
var_self=(typeofwindow!=='undefined')
? window// if in browser
: ((typeofWorkerGlobalScope!=='undefined'&&selfinstanceofWorkerGlobalScope)
? self// if in worker
: {}// if in node js);
Replacing self with globalThis, the script works fine:
var_self=(typeofwindow!=='undefined')
? window// if in browser
: ((typeofWorkerGlobalScope!=='undefined'&&globalThisinstanceofWorkerGlobalScope)
? globalThis// if in worker
: {}// if in node js);
The problem seems to exist only in NPM packages, because the following js file run in a Worker doesn't fail:
console.log(self);
The text was updated successfully, but these errors were encountered:
Version: Deno 1.45.5
I have the following code:
That it's executed inside a worker:
And this produces the following error:
Looks like the
self
object is not defined inside Prism npm package. It's accessed here:Replacing
self
withglobalThis
, the script works fine:The problem seems to exist only in NPM packages, because the following js file run in a Worker doesn't fail:
The text was updated successfully, but these errors were encountered: