Browser: Use of requiring hypercore with browserify, not working
moskalyk opened this issue · comments
Getting the following error on hypercore import in a react app that is transpiled using browserify.
Ex. Use:
const hypercore = require( 'hypercore' )
Setup
OS: Mac (Catalina) / Windows
Browsers: Opera, Chrome, Beaker
Experienced the same error on all:
TypeError: Cannot read property 'variables' of undefined
at Object.<anonymous> (bundle.js:148994)
at Object.1051._process (bundle.js:149144)
at o (bundle.js:1)
at bundle.js:1
at Object.<anonymous> (bundle.js:148974)
at Object.1050.node-gyp-build (bundle.js:148978)
at o (bundle.js:1)
at bundle.js:1
at Object.<anonymous> (bundle.js:53240)
at Object.633../cipher-state (bundle.js:53744)
Digging further, error on line:
var armv = process.env.ARM_VERSION || (arch === 'arm64' ? '8' : process.config.variables.arm_version) || ''
Had importing hypercore working before in browser.
Even tried downgrading to v7.12, no luck.
Thoughts?
It won't work in the browser atm due to missing crypto primitives I'm pretty sure
works now
Thank you - seem to still be getting this error:
/node_modules/sodium-javascript/memory.js
Module not found: Can't resolve 'worker_threads'
@moskalyk what env? browserify etc etc?