Skip to content
Permalink
Browse files
feat: serve ESM bundle
  • Loading branch information
darrachequesne committed Oct 13, 2021
1 parent eb5fdbd commit 60edecb3bd33801803cdcba0aefbafa381a2abb3
Showing with 16 additions and 1 deletion.
  1. +7 −0 client-dist/socket.io.esm.min.js
  2. +1 −0 client-dist/socket.io.esm.min.js.map
  3. +1 −1 lib/index.ts
  4. +7 −0 test/socket.io.ts

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -238,7 +238,7 @@ export class Server<
this.clientPathRegex = new RegExp(
"^" +
escapedPath +
"/socket\\.io(\\.min|\\.msgpack\\.min)?\\.js(\\.map)?(?:\\?|$)"
"/socket\\.io(\\.msgpack|\\.esm)?(\\.min)?\\.js(\\.map)?(?:\\?|$)"
);
return this;
}
@@ -125,6 +125,13 @@ describe("socket.io", () => {
testSourceMap("socket.io.msgpack.min.js.map")
);

it("should serve the ESM bundle", testSource("socket.io.esm.min.js"));

it(
"should serve the source map for the ESM bundle",
testSourceMap("socket.io.esm.min.js.map")
);

it("should handle 304", (done) => {
const srv = createServer();
new Server(srv);

2 comments on commit 60edecb

@chriskrycho

This comment has been minimized.

Copy link

@chriskrycho chriskrycho replied Oct 14, 2021

Hey folks, heads up that this seems to have broken testem. I'm investigating with a number of other folks in the Ember community (Ember's test infra uses testem which uses socket.io) as a bunch of our CI builds started failing today. The surfacing issue is io.connect is not a function: it looks like testem expects io to be a namespace-style object in the global namespace—it's just loading it directly via <script> tag. I'm still poking around and trying to see exactly why and what the fix might be – reading this change, it's not obvious to me why it's serving the rolled-up ESM rather than the default globals build.

@chriskrycho

This comment has been minimized.

Copy link

@chriskrycho chriskrycho replied Oct 14, 2021

Correction: Testem is serving it via Express app which requires socketIO as the default CJS export and expecting that to serve it. This makes me suspect the issue is (related to?) the update to the API of engine.io in its 6.0.0.

Possibly related (but, I think, not identical): #4120

[I'm opening an issue to track this and will move these comments there.]

Edit: #4121

Please sign in to comment.