module ws does not provide an export named WebSocketServer
John Reilly
October 15, 2024
I use Playwright for testing and mock Web Socket calls with the ws package. I recently did an npm upgrade and found myself hitting this error message when I tried to run tests:
It was caused by the following code:
The fix was surprisingly simple to implement but hard to search for. That's why I'm writing this.
Resolving "The requested module 'ws' does not provide"...
This fix is as simple switching the code to:
And that should resolve the issue.
Discussion in the ATmosphere