Skip to content

Commit

Permalink
fix: restore the default export
Browse files Browse the repository at this point in the history
The default export was accidentally removed in [1].

Note: that being said, users are encouraged to use the named exports,
because the default export has a different meaning for CommonJS and ES
modules users.

```js
// BAD
import io from "socket.io-client";

// GOOD
import { io } from "socket.io-client";
```

Related:

- #1505
- #1507
- #1508

[1]: 16b6569
  • Loading branch information
darrachequesne committed Oct 15, 2021
1 parent 8737d0a commit f0aae84
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ Object.assign(lookup, {
connect: lookup,
});

if (typeof module !== "undefined") {
module.exports = lookup;
}

/**
* Protocol version.
*
Expand All @@ -101,4 +105,5 @@ export {
SocketOptions,
lookup as io,
lookup as connect,
lookup as default,
};

0 comments on commit f0aae84

Please sign in to comment.