connex
connex copied to clipboard
ReferenceError: self is not defined
My code
import Connex from '@vechain/connex'
const connex = new Connex({ node: 'https://testnet.veblocks.net/', network: 'test' })
======Response======= eracomtechnologies@Eracoms-MacBook-Pro c9x % node index.mjs /Users/eracomtechnologies/Eracom/node_modules/@vechain/connex/dist/connex.js:10 })(self, function() { ^
ReferenceError: self is not defined
at Object.
https://github.com/vechain/connex/tree/master/packages/connex#using-in-nodejs-environment
https://github.com/vechain/connex/tree/master/packages/connex#using-in-nodejs-environment
I'm not able to import this lib into client Node code with ssr enabled. If possible, would be nice to add a shim so if the browser object is not defined than no error would be thrown immediately. The workaround is to conditionally/dynamically import the library, but that is not always possible, and seems like ideally the entry point would evaluate whether the required object even exists (and if it does not, nothing should be ran)