summaryrefslogtreecommitdiff
path: root/packages/integrations/lit/server-shim.js
diff options
context:
space:
mode:
authorGravatar Erika <3019731+Princesseuh@users.noreply.github.com> 2023-01-09 22:59:20 +0100
committerGravatar GitHub <noreply@github.com> 2023-01-09 16:59:20 -0500
commit1f92d64ea35c03fec43aff64eaf704dc5a9eb30a (patch)
tree08f65d274320dbff2b7a869032adb0f725a4aa64 /packages/integrations/lit/server-shim.js
parent9bb08bfe8c400d468de454c69810e18794263439 (diff)
downloadastro-1f92d64ea35c03fec43aff64eaf704dc5a9eb30a.tar.gz
astro-1f92d64ea35c03fec43aff64eaf704dc5a9eb30a.tar.zst
astro-1f92d64ea35c03fec43aff64eaf704dc5a9eb30a.zip
Drop Node 14 support (#5782)
* chore: Update engines field * fix(deps): Remove node-fetch * feat(polyfills): Remove node-fetch for undici * feat(webapi): Remove node-fetch from the webapis polyfills for undici * feat(core): Remove node-fetch for undici in Astro core * feat(telemetry): Remove node-fetch for undici * feat(node): Remove node-fetch for undici in node integration * feat(vercel): Remove node-fetch for undici in Vercel integration * chore: update lockfile * chore: update lockfile * chore: changeset * fix(set): Fix set directives not streaming correctly on Node 16 * Try another approach * Debugging * Debug fetch * Use global fetch if there is one * changeset for lit * Remove web-streams-polyfill * Remove web-streams-polyfill license note * Update .changeset/stupid-wolves-explain.md Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com> Co-authored-by: Matthew Phillips <matthew@skypack.dev> Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Diffstat (limited to 'packages/integrations/lit/server-shim.js')
-rw-r--r--packages/integrations/lit/server-shim.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/integrations/lit/server-shim.js b/packages/integrations/lit/server-shim.js
index 9a4c7e408..873d3cd82 100644
--- a/packages/integrations/lit/server-shim.js
+++ b/packages/integrations/lit/server-shim.js
@@ -1,5 +1,12 @@
import { installWindowOnGlobal } from '@lit-labs/ssr/lib/dom-shim.js';
-installWindowOnGlobal();
+
+if(typeof fetch === 'function') {
+ const _fetch = fetch;
+ installWindowOnGlobal();
+ globalThis.fetch = window.fetch = _fetch;
+} else {
+ installWindowOnGlobal();
+}
window.global = window;
document.getElementsByTagName = () => [];