Skip to content

Commit

Permalink
don't patch if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
justjavac committed Jul 14, 2023
1 parent d29c156 commit 356780a
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions packages/kit/src/exports/node/polyfills.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,12 @@ const globals = {
*/
export function installPolyfills() {
for (const name in globals) {
const desc = Object.getOwnPropertyDescriptor(globalThis, name);
if (desc === undefined || desc.configurable) {
Object.defineProperty(globalThis, name, {
enumerable: true,
configurable: true,
writable: true,
value: globals[name]
});
} else if (desc.writable) {
// @ts-expect-error
globalThis[name] = globals[name];
}
if (Object.hasOwnProperty.call(globalThis, name)) continue;
Object.defineProperty(globalThis, name, {
enumerable: true,
configurable: true,
writable: true,
value: globals[name]
});
}
}

0 comments on commit 356780a

Please sign in to comment.