From 6dd2bc4f68edd7575c3844ae8ceadde649be95b2 Mon Sep 17 00:00:00 2001 From: Ben Weintraub Date: Tue, 27 Jun 2023 03:01:26 -0400 Subject: [PATCH] fix: prevent crash when accessing TextDecoder (#684) The TextDecoder object was added on the global object in Node.js v11.0.0, so older versions would throw: > ReferenceError: TextDecoder is not defined Reference: https://nodejs.org/api/util.html#new-textdecoderencoding-options --- lib/server.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/server.ts b/lib/server.ts index 2dba26db..355e14d5 100644 --- a/lib/server.ts +++ b/lib/server.ts @@ -16,6 +16,7 @@ import type { CookieSerializeOptions } from "cookie"; import type { CorsOptions, CorsOptionsDelegate } from "cors"; import type { Duplex } from "stream"; import { WebTransport } from "./transports/webtransport"; +import { TextDecoder } from "util"; const debug = debugModule("engine");