SocketCluster / socketcluster-client

JavaScript client for SocketCluster
MIT License
290 stars 92 forks source link

Unable to resolve as a es module #144

Open romanzy313 opened 2 years ago

romanzy313 commented 2 years ago

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.