Skip to content

Commit f4d3c46

Browse files
authoredJan 20, 2025
fix: crypto.getRandomValues is not available in old Node versions (#19237)
1 parent 9e460f5 commit f4d3c46

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎packages/vite/src/node/config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ export async function resolveConfig(
767767
// at least 64bits is recommended
768768
// https://owasp.org/www-community/vulnerabilities/Insufficient_Session-ID_Length
769769
webSocketToken: Buffer.from(
770-
crypto.getRandomValues(new Uint8Array(9)),
770+
crypto.randomFillSync(new Uint8Array(9)),
771771
).toString('base64url'),
772772
additionalAllowedHosts: getAdditionalAllowedHosts(server, preview),
773773
getSortedPlugins: undefined!,

0 commit comments

Comments
 (0)
Please sign in to comment.