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
The DOM shim for @lit-labs/ssr does not inherit the builtin Node APIs from the environment onto the global object. Some third party libraries like koa expect them to be there.
Steps to Reproduce
Write this code
import{installWindowOnGlobal}from'@lit-labs/ssr/lib/dom-shim';installWindowOnGlobal();if(!global.Promise){thrownewError('global.Promise is missing');}
See this output...
It'll throw because global.Promise is undefined.
Live Reproduction Link
N/A
Expected Results
global.Promise should be the native Node Promise API
Actual Results
No error should be thrown.
Browsers Affected
N/A
The text was updated successfully, but these errors were encountered:
aomarks
changed the title
installWindowOnGlobal shim globalThis.global does not inherit any of the existing builtins like Promise
[ssr] installWindowOnGlobal shim globalThis.global does not inherit any of the existing builtins like Promise
Sep 1, 2021
…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
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#2118
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?
Fixeslit#2118
Description
The DOM shim for @lit-labs/ssr does not inherit the builtin Node APIs from the environment onto the global object. Some third party libraries like koa expect them to be there.
Steps to Reproduce
It'll throw because global.Promise is undefined.
Live Reproduction Link
N/A
Expected Results
global.Promise should be the native Node Promise API
Actual Results
No error should be thrown.
Browsers Affected
N/A
The text was updated successfully, but these errors were encountered: