SocketCluster / SocketCluster/socketcluster-client
Unable to resolve as a es module
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 300
- Forks
- 90
- PR merge metrics
- No merged PRs in 30d
Description
I want to use the client in my typescript project. But I face the following issue:
Uncaught SyntaxError: The requested module './../../../node_modules/socketcluster-client/index.js' does not provide an export named 'default' (at index.ts:1:8)
My index.ts file:
`import socketClusterClient from 'socketcluster-client';
const socket = socketClusterClient.create();`
I am using [https://open-wc.org/guides/](Open WC starter) in order to have a convenient bundle-free development. I have experienced the same issue with socket.io implementation of their client, probable because browserify library is used.
This framework is very forward looking with for await of everywhere, yet I cant import it as an ES6 module?
Cli generator works around this by doing <script type="text/javascript" src="/socketcluster-client.js"></script>, which is not how it is done these-days.
How can I solve this issue? Thank you.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting index.ts and the package's node_modules/socketcluster-client/index.js export shape, then compare it with the Open WC starter's native module loading. Check how the CLI generator uses socketcluster-client.js; done means the client can be imported as an ES module without the script-tag workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100