mirror of
https://github.com/amark/gun.git
synced 2025-06-05 21:56:51 +00:00
Fixed Webpack issues.
This commit is contained in:
parent
795d60983f
commit
a9fd953ab8
4
sea.js
4
sea.js
@ -22,7 +22,7 @@
|
||||
let crypto
|
||||
let funcsSetter
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
if (typeof __webpack_require__ === 'function' || typeof window !== 'undefined') {
|
||||
const wc = window.crypto || window.msCrypto // STD or M$
|
||||
subtle = wc.subtle || wc.webkitSubtle // STD or iSafari
|
||||
getRandomBytes = (len) => Buffer.from(wc.getRandomValues(new Uint8Array(Buffer.alloc(len))))
|
||||
@ -47,7 +47,7 @@
|
||||
}
|
||||
const { TextEncoder, TextDecoder, sessionStorage, localStorage } = funcsSetter()
|
||||
|
||||
if (typeof global !== 'undefined') {
|
||||
if (typeof __webpack_require__ !== 'function' && typeof global !== 'undefined') {
|
||||
global.sessionStorage = sessionStorage
|
||||
global.localStorage = localStorage
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user