Skip to content

Commit 51cd6e6

Browse files
fix: update polyfills.js to include File (#8925)
* Update polyfills.js * Update polyfills.js * Changeset * try this --------- Co-authored-by: Rich Harris <[email protected]>
1 parent 475ae48 commit 51cd6e6

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.changeset/famous-hornets-invite.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': patch
3+
---
4+
5+
chore: polyfill File from node:buffer

packages/kit/src/exports/node/polyfills.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { ReadableStream, TransformStream, WritableStream } from 'node:stream/web';
2+
import buffer from 'node:buffer';
23
import { webcrypto as crypto } from 'node:crypto';
3-
import { fetch, Response, Request, Headers, FormData } from 'undici';
4+
import { fetch, Response, Request, Headers, FormData, File as UndiciFile } from 'undici';
5+
6+
// @ts-expect-error
7+
const File = buffer.File ?? UndiciFile;
48

59
/** @type {Record<string, any>} */
610
const globals = {
@@ -12,7 +16,8 @@ const globals = {
1216
ReadableStream,
1317
TransformStream,
1418
WritableStream,
15-
FormData
19+
FormData,
20+
File
1621
};
1722

1823
// exported for dev/preview and node environments

0 commit comments

Comments
 (0)