fix(core): Add a WebCrypto Polyfill for older versions of Node.js 18 (#9894)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-07-01 12:19:00 +02:00 committed by GitHub
parent dc1c5fce8a
commit 59c8bf1c44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -55,6 +55,11 @@ if (process.env.NODEJS_PREFER_IPV4 === 'true') {
// More details: https://github.com/nodejs/node/issues/48145
require('net').setDefaultAutoSelectFamily?.(false);
// WebCrypto Polyfill for older versions of Node.js 18
if (!globalThis.crypto?.getRandomValues) {
globalThis.crypto = require('node:crypto').webcrypto;
}
(async () => {
const oclif = await import('@oclif/core');
await oclif.execute({ dir: __dirname });