blob: 57960e4fadeaef880678cd4ac353049c5730c17e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
globalThis.global = globalThis;
import { Buffer } from "buffer";
import { URL } from "url-polyfill";
import { TextEncoder, TextDecoder } from "fast-text-encoding";
import * as React from "react";
const onlyChildPolyfill = React.Children.only;
React.Children.only = function (children) {
if (
children &&
typeof children === "object" &&
(children as any).length == 1
) {
return onlyChildPolyfill(children[0]);
}
return onlyChildPolyfill(children);
};
globalThis.Buffer = Buffer;
globalThis.URL = URL;
globalThis.TextEncoder ||= TextEncoder;
globalThis.TextDecoder ||= TextDecoder;
|