RangerMauve / hyper-sdk

Make your own hyper apps!
https://www.youtube.com/watch?v=HyHk4aImd_I&list=PL7sG5SCUNyeYx8wnfMOUpsh7rM_g0w_cu&index=20
MIT License
291 stars 46 forks source link

TypeError: hyperswarm is not a function #91

Closed r-token closed 1 year ago

r-token commented 3 years ago

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:

hyperswarm-not-a-function

It looks like the 'not a function' part it's referring to is from here:

hyperswarm-invalid

And that hyperswarm comes from the hyperswarm-web package:

Screen Shot 2021-08-05 at 3 30 13 PM

Let me know if you need any additional information or if you'd prefer me to log this issue in the hyperswarm-web repo.

RangerMauve commented 3 years ago

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.

r-token commented 3 years ago

Whoops, missed your reply. Apologies! To answer your questions:

1) Yes we were trying to use hyper-sdk within a web app 2) 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.

RangerMauve commented 1 year ago

New version of hyper-sdk should change this. Please reopen if you're still facing this error.