Skip to content

Commit 963b12b

Browse files
committed
fix(random-bytes): fallback to insecure path if require is null
1 parent c210a69 commit 963b12b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/parser/utils.js

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ if (typeof window !== 'undefined' && window.crypto && window.crypto.getRandomVal
2525
} catch (e) {
2626
// keep the fallback
2727
}
28+
29+
// NOTE: in transpiled cases the above require might return null/undefined
30+
if (randomBytes == null) {
31+
randomBytes = insecureRandomBytes;
32+
}
2833
}
2934

3035
module.exports = {

0 commit comments

Comments
 (0)