From f0aae8457a8bdf7e2f2286b4b7d34d2798419456 Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Sat, 16 Oct 2021 00:30:48 +0200 Subject: [PATCH] fix: restore the default export 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: - https://github.com/socketio/socket.io-client/issues/1505 - https://github.com/socketio/socket.io-client/issues/1507 - https://github.com/socketio/socket.io-client/issues/1508 [1]: https://github.com/socketio/socket.io-client/commit/16b65698aed766e1e645c78847f2e91bfc5b6f56 --- lib/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/index.ts b/lib/index.ts index 27d35166..cfae547d 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -80,6 +80,10 @@ Object.assign(lookup, { connect: lookup, }); +if (typeof module !== "undefined") { + module.exports = lookup; +} + /** * Protocol version. * @@ -101,4 +105,5 @@ export { SocketOptions, lookup as io, lookup as connect, + lookup as default, };