Skip to content
Source
Sign inSign up
TanStack/cli
Open History to see the last commit

polyfill.ts

21 lines730 Bytes

1import { File } from "node:buffer";
2​
3/**
4 * This file aims to polyfill missing APIs in Node.js 18 that oRPC depends on.
5 *
6 * Since Stackblitz runs on Node.js 18, these polyfills ensure oRPC works in that environment.
7 * If you're running oRPC locally, please use Node.js 20 or later for full compatibility.
8 */
9​
10/**
11 * Note: Stackblitz provides an emulated Node.js environment with inherent limitations.
12 * If you encounter issues, please test on a local setup with Node.js 20 or later before reporting them.
13 */
14​
15/**
16 * The `oz.file()` schema depends on the `File` API.
17 * If you're not using `oz.file()`, you can safely remove this polyfill.
18 */
19if (typeof globalThis.File === "undefined") {
20 globalThis.File = File as any;