`WebSocketServer` is not a constructor

Hello all 👋 I've built a simple Next.js app and got it deployed with CF Pages. I'm now integrating it with D1 databases and would like to run some tests on CI. I can't instantiate miniflare, though. It keeps complaining with the following:
TypeError: import_ws3.WebSocketServer is not a constructor
TypeError: import_ws3.WebSocketServer is not a constructor
I theoretically could extract everything that touches D1 or KV to a mockable interface, but I'd like to avoid that and use Miniflare instead. Do you have a guide or hints on how to get it working? 🙂
1 Reply
MrBBot
MrBBot•13mo ago
Hey! 👋 A few questions: - What version of miniflare are you using? - What testing framework (if any) are you using? - Are you trying to bundle miniflare/your tests before running them? If so, what bundler are you using? It looks like you might be bundling miniflare with esbuild or something. If possible, I'd recommend marking miniflare as an external so it doesn't get included in your bundle.
Want results from more Discord servers?
Add your server