-
Notifications
You must be signed in to change notification settings - Fork 880
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
[ssr] Don't assign DOM shim window.global to window #2120
Conversation
…window This means that globalThis.global will retain its Node built-ins, whereas before it would lose anything we didn't explicitly set on window. Fixes #2118
🦋 Changeset detectedLatest commit: 32a0307 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📊 Tachometer Benchmark ResultsSummarynop-update
render
update
update-reflect
Resultslit-element-list
render
update
update-reflect
lit-html-kitchen-sink
render
update
nop-update
lit-html-repeat
render
update
lit-html-template-heavy
render
update
reactive-element-list
render
update
update-reflect
|
|
||
// User-provided globals, like `require` | ||
...props, | ||
}; | ||
|
||
window.window = window; | ||
window.global = window; // Required for node-fetch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about node-fetch here? Should we do something like this?
Object.assign(window.global, window):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See PR description -- unless you know a reason it actually fails?
If we do need it, I think we can do window.global = globalThis
This will go out with the next batch of Lit RC releases, probably a little later this week. |
This means that globalThis.global will retain its Node built-ins, and globalThis.global === globalThis will hold, whereas before it would lose anything we didn't explicitly set on window, so something like global.Promise would be undefined. This window.global assignment seems to have been done for compatibility with node-fetch, but I tried a fetch from the demo/global/module.js module, and the fetch seemed to work fine. Not sure if there is another invocation path I missed, but it seems ok? Fixes lit#2118
This means that
globalThis.global
will retain its Node built-ins, andglobalThis.global === globalThis
will hold, whereas before it would lose anything we didn't explicitly set onwindow
, so something likeglobal.Promise
would beundefined
.This
window.global
assignment seems to have been done for compatibility withnode-fetch
, but I tried afetch
from thedemo/global/module.js
module, and the fetch seemed to work fine. Not sure if there is another invocation path I missed, but it seems ok?Fixes #2118
cc @fetherston