randombytes
: Replace run-time require detection
Using require() as an expression leads to compile errors in webpack. This issue can be solved by guarding the use of require by the 'correct' run-time check using `typeof require`.
This commit is contained in:
parent
ae2df3305e
commit
f93d546ee0
@ -20,7 +20,7 @@ var randombytes = (function () {
|
||||
|
||||
if (crypto && crypto.getRandomValues) return browserBytes
|
||||
|
||||
if (require != null) {
|
||||
if (typeof require === 'function') {
|
||||
// Node.js. Bust Browserify
|
||||
crypto = require('cry' + 'pto')
|
||||
if (crypto && crypto.randomBytes) return nodeBytes
|
||||
|
Loading…
Reference in New Issue
Block a user