You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working with an Electron app, the renderer process (which runs in the context of a web page) requires using npm packages designed for client-side (browser) environments. Our package has different entry points depending on whether it is being used in a browser or Node.js environment.
Your build setup doesn’t automatically select the "browser" field and tries to use Node.js version instead, that's why you are getting this error.
To avoid this you can use build tools and bundlers like Webpack, that automatically prefer the "browser" field when bundling for the renderer process.
Another option is to directly import browser version in your app: import 'ably/build/ably.js'.
when i import this in my app
import 'ably/build/ably.js'
i got this error
Module not found: Package path ./build/ably.js is not exported from package /Users/al-raqeem/Documents/GitHub/Clinic360-frontend/node_modules/ably (see exports field in /Users/al-raqeem/Documents/GitHub/Clinic360-frontend/node_modules/ably/package.json)
src/contexts/SocketContext.js
Your build setup respects the exports fields and prevents importing undeclared modules. So it shouldn't try to use node version of the library in the renderer process. Could you provide a minimal reproducible example or steps for us to reproduce the issue?
ably-node.js:767 11:51:50.942 Ably: WebSocketTransport.connect(): Unexpected exception creating websocket: err = Error: ws does not work in the browser. Browser clients must use the native WebSocket object
at new module.exports (http://localhost:8080/main.js:132830:9)
at WebSocketTransport.createWebSocket (http://localhost:8080/main.js:31727:12)
at http://localhost:8080/main.js:31760:59
at http://localhost:8080/main.js:24972:33
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
┆Issue is synchronized with this Jira Task by Unito
The text was updated successfully, but these errors were encountered: