hapijs / nes

WebSocket adapter plugin for hapi routes
Other
502 stars 87 forks source link

Client is not working in browser. #294

Closed Invader444 closed 4 years ago

Invader444 commented 4 years ago

Support plan

Context

What are you trying to achieve or the steps to reproduce?

`import { Client } from '@hapi/nes'`

What was the result you got?

index.js?cf2e:63 Uncaught TypeError: Joi.binary is not a function
    at eval (index.js?cf2e:63)
    at Object../app/node_modules/@hapi/nes/lib/index.js (bundle.js:3746)
    at __webpack_require__ (bundle.js:727)
    at fn (bundle.js:101)
    at Module.eval (networking.js:2)
    at eval (networking.js:354)
    at Module../app/js/sagas/networking.js (bundle.js:2907)
    at __webpack_require__ (bundle.js:727)
    at fn (bundle.js:101)
    at Module.eval (index.js:19)

What result did you expect?

No error should be thrown.

hueniverse commented 4 years ago

Can you try import Client from '@hapi/nes/lib/client' instead?

Invader444 commented 4 years ago
import { Client } from '@hapi/nes/lib/client'

or

const Client = require('@hapi/nes/lib/client').Client

Works as a workaround for now. Thank you!

hueniverse commented 4 years ago

Can you try one more thing for me? Can you add "browser": "lib/client.js" to package.json locally and see if that also works?

hueniverse commented 4 years ago

If someone can try the proposed change above to package.json we might be able to just fix it.

julianYaman commented 2 years ago

Got problems with it in Next.js. Did anyone else experienced something like that?