fix: missing fetch-dependent interfaces in Node.js (#42419)

fix: missing fetch-dependent interfaces in Node.js
This commit is contained in:
Shelley Vohr 2024-06-11 16:59:53 -05:00 committed by GitHub
parent ea219dd702
commit 4aa9070e6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 11 deletions

View file

@ -3,8 +3,11 @@ import { wrapFsWithAsar } from './asar-fs-wrapper';
wrapFsWithAsar(require('fs'));
// See ElectronRendererClient::DidCreateScriptContext.
if ((globalThis as any).blinkFetch) {
globalThis.fetch = (globalThis as any).blinkFetch;
if ((globalThis as any).blinkfetch) {
const keys = ['fetch', 'Response', 'FormData', 'Request', 'Headers'];
for (const key of keys) {
(globalThis as any)[key] = (globalThis as any)[`blink${key}`];
}
}
// Hook child_process.fork.