Skip to content

Commit

Permalink
fix: crypto.getRandomValues is not available in old Node versions (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red authored Jan 20, 2025
1 parent 9e460f5 commit f4d3c46
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vite/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!,
Expand Down

0 comments on commit f4d3c46

Please sign in to comment.