-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[npm]: window
global cannot be set
#19286
Comments
Looking a bit into this:
Not sure how to best solve this. Removing the |
We need to remove the |
+1 on removing it. I understand the original reasoning behind it, but having something called See https://github.com/search?q=%22typeof+window+%3D%3D%3D+%5C%22undefined%5C%22%22&type=code |
The deletion for the npm commonjs context doesn't even seem to be working 🤔 Running detects both
|
Deno's node emulation can run TiddlyWiki now that it supports the VM isolates API, but the window global exists in that environment, so both browser and node were being detected, causing the autoboot to trip up on nonexistent argv, as the boot was happening in the constructor right before argv was set. Ref: denoland/deno#19286 Ref: https://github.com/flexdinesh/browser-or-node
Deno's node emulation can run TiddlyWiki now that it supports the VM isolates API, but the window global exists in that environment, so both browser and node were being detected, causing the autoboot to trip up on nonexistent argv, as the boot was happening in the constructor right before argv was set. Ref: denoland/deno#19286 Ref: https://github.com/flexdinesh/browser-or-node
@valpackett Please try |
…dlyWiki#8423) Deno's node emulation can run TiddlyWiki now that it supports the VM isolates API, but the window global exists in that environment, so both browser and node were being detected, causing the autoboot to trip up on nonexistent argv, as the boot was happening in the constructor right before argv was set. Ref: denoland/deno#19286 Ref: https://github.com/flexdinesh/browser-or-node
This appears to no longer be an issue. |
A couple of testing frameworks rely on JSDOM, happy-dom and similar libraries to provide a fake DOM and browser event implementation. This usually relies on the
window
global being created (or patched).In Deno the global variable
window
seems to be special cased. I'm not able to modifywindow
and read the changes inside an npm package. This is a very common scenarios with the mentioned libraries. Typically they set upwindow
as a global, and another import to the framework reads that global.In ESM mode the
window
global exists which seems to be Deno's Window object. With a CommonJS package thewindow
global is not present which leads to aTypeError
.Steps to reproduce
deno run -A foo.js
If successful, the string
"it works"
should have been printed to the console.The text was updated successfully, but these errors were encountered: