File tree Expand file tree Collapse file tree 3 files changed +8
-13
lines changed Expand file tree Collapse file tree 3 files changed +8
-13
lines changed Original file line number Diff line number Diff line change 1
1
import * as WebFetch from "./fetch.js"
2
2
3
3
export { ReadableStream , Blob , FormData } from './package.js' ;
4
- // Electron-renderer should get the browser implementation instead of node
5
- // Browser configuration is not enough
4
+ // Node 18+ introduces fetch API globally and it doesn't support our use-cases yet.
5
+ // For now we always use the polyfill.
6
6
7
7
// Marking export as a DOM File object instead of custom class.
8
8
export const fetch = /** @type {typeof globalThis.fetch } */
9
- ( typeof globalThis . fetch === "function" ? globalThis . fetch : WebFetch . fetch )
9
+ WebFetch . fetch
10
10
11
- export const Headers = globalThis . Headers || WebFetch . Headers
12
- export const Request = globalThis . Request || WebFetch . Request
13
- export const Response = global . Response || WebFetch . Response
11
+ export const Headers = WebFetch . Headers
12
+ export const Request = WebFetch . Request
13
+ export const Response = WebFetch . Response
14
14
15
15
export default fetch
Original file line number Diff line number Diff line change @@ -8,6 +8,6 @@ import { File as WebFile } from "./file.js"
8
8
9
9
// Marking export as a DOM File object instead of custom class.
10
10
/** @type {typeof globalThis.File } */
11
- const File = typeof globalThis . File === "function" ? globalThis . File : WebFile
11
+ const File = WebFile
12
12
13
13
export { File , Blob }
Original file line number Diff line number Diff line change 3
3
4
4
import * as polyfill from "./form-data.js"
5
5
6
- // Electron-renderer should get the browser implementation instead of node
7
- // which is why we check global first.
8
- export const FormData =
9
- typeof globalThis . FormData === "function"
10
- ? globalThis . FormData
11
- : polyfill . FormData
6
+ export const FormData = polyfill . FormData
You can’t perform that action at this time.
0 commit comments