mirror of
https://github.com/socketio/socket.io.git
synced 2026-01-09 15:08:12 -05:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user