Skip to content
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

feat(remix-node): only polyfill globals if they're not present #6259

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions packages/remix-node/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ declare global {
}

export function installGlobals() {
global.atob = atob;
global.btoa = btoa;
global.atob ||= atob;
global.btoa ||= btoa;

global.Blob = NodeBlob;
global.File = NodeFile;
global.Blob ||= NodeBlob;
global.File ||= NodeFile;

global.Headers = NodeHeaders as typeof Headers;
global.Request = NodeRequest as typeof Request;
global.Response = NodeResponse as unknown as typeof Response;
global.fetch = nodeFetch as typeof fetch;
global.FormData = NodeFormData;
global.Headers ||= NodeHeaders as typeof Headers;
global.Request ||= NodeRequest as typeof Request;
global.Response ||= NodeResponse as unknown as typeof Response;
global.fetch ||= nodeFetch as typeof fetch;
global.FormData ||= NodeFormData;

global.ReadableStream = NodeReadableStream;
global.WritableStream = NodeWritableStream;
global.ReadableStream ||= NodeReadableStream;
global.WritableStream ||= NodeWritableStream;

global.AbortController = global.AbortController || NodeAbortController;
}