Skip to content

Commit 5e9727b

Browse files
committed
Replace webpack outsmart with stub
1 parent 309eb98 commit 5e9727b

File tree

6 files changed

+10
-6
lines changed

6 files changed

+10
-6
lines changed

dist/index.esm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function detectPrng() {
107107
};
108108
} else {
109109
try {
110-
var nodeCrypto = global["require"]("crypto");
110+
var nodeCrypto = require("crypto");
111111
return function () {
112112
return nodeCrypto.randomBytes(1).readUInt8() / 0xff;
113113
};

dist/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export function detectPrng(allowInsecure = false, root) {
109109
}
110110
else {
111111
try {
112-
const nodeCrypto = global["require"]("crypto");
112+
const nodeCrypto = require("crypto");
113113
return () => nodeCrypto.randomBytes(1).readUInt8() / 0xff;
114114
}
115115
catch (e) { }

dist/index.umd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function detectPrng() {
113113
};
114114
} else {
115115
try {
116-
var nodeCrypto = global["require"]("crypto");
116+
var nodeCrypto = require("crypto");
117117
return function () {
118118
return nodeCrypto.randomBytes(1).readUInt8() / 0xff;
119119
};

lib/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export function detectPrng(allowInsecure: boolean = false, root?: any): PRNG {
130130
}
131131
} else {
132132
try {
133-
const nodeCrypto = global["require"]("crypto")
133+
const nodeCrypto = require("crypto")
134134
return () => nodeCrypto.randomBytes(1).readUInt8() / 0xff
135135
} catch (e) {}
136136
}

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@
4040
},
4141
"files": [
4242
"bin",
43-
"dist"
43+
"dist",
44+
"stubs"
4445
],
45-
"bin": "./bin/cli.js"
46+
"bin": "./bin/cli.js",
47+
"browser": {
48+
"crypto": "./stubs/crypto.js"
49+
}
4650
}

stubs/crypto.js

Whitespace-only changes.

0 commit comments

Comments
 (0)