hyper-sdk
hyper-sdk copied to clipboard
TypeError: hyperswarm is not a function
When using the hyper-sdk
via npm
and requiring it in a file, I get an error that says Uncaught (in promise) TypeError: hyperswarm is not a function
. This error doesn't occur when I build the bundle for browsers myself and include the hyper-sdk-bundle.js
file in the project manually - but going this route won't work well for our setup.
The full error is below:
It looks like the 'not a function' part it's referring to is from here:
And that hyperswarm
comes from the hyperswarm-web
package:
Let me know if you need any additional information or if you'd prefer me to log this issue in the hyperswarm-web repo.
Just to confirm, are you trying to use hyper-sdk inside a webapp?
What are you using to make require
work in the browser? There have been a bunch of issues with webpack, and I think building the bundle is the only surefire way to get stuff working.
Whoops, missed your reply. Apologies! To answer your questions:
- Yes we were trying to use hyper-sdk within a web app
- We're using Browserify or Parcel for this (not webpack)
Also, building the bundle did indeed get past this issue - using a bundler just fits in nicer with our current workflow.
New version of hyper-sdk should change this. Please reopen if you're still facing this error.