fix(engine.io-client): correctly consume the ws package (#5220)

This should fix the following issue:

```
SyntaxError: Named export 'WebSocket' not found. The requested module 'ws' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'ws';
const { WebSocket } = pkg;
```
This commit is contained in:
Ben McCann
2025-01-07 01:53:32 -08:00
committed by GitHub
parent 7427109658
commit 7fcddcb3bb

View File

@@ -1,4 +1,4 @@
import { WebSocket } from "ws";
import * as ws from "ws";
import type { Packet, RawData } from "engine.io-parser";
import { BaseWS } from "./websocket.js";
@@ -27,7 +27,7 @@ export class WS extends BaseWS {
opts.headers.cookie.push(`${name}=${cookie.value}`);
}
}
return new WebSocket(uri, protocols, opts);
return new ws.WebSocket(uri, protocols, opts);
}
doWrite(packet: Packet, data: RawData) {