From f4d3c4645ff1acecb26ba2c98a421d6ed6c99644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Mon, 20 Jan 2025 19:34:11 +0900 Subject: [PATCH] fix: `crypto.getRandomValues` is not available in old Node versions (#19237) --- packages/vite/src/node/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 4d1a6da06333de..cd41256761acf3 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -767,7 +767,7 @@ export async function resolveConfig( // at least 64bits is recommended // https://owasp.org/www-community/vulnerabilities/Insufficient_Session-ID_Length webSocketToken: Buffer.from( - crypto.getRandomValues(new Uint8Array(9)), + crypto.randomFillSync(new Uint8Array(9)), ).toString('base64url'), additionalAllowedHosts: getAdditionalAllowedHosts(server, preview), getSortedPlugins: undefined!,