dxw / js-cop-games

A repo for the Javascript community of practice's games
0 stars 0 forks source link

Add SocketIO package to externals #203

Closed richpjames closed 2 months ago

richpjames commented 2 months ago

This package is imported via index.html and we are just using the types here. But if we don't tell the bundler that it's externally imported it then it will add it to the bundled code making a bigger and harder to scan bundle. Docs: https://bun.sh/docs/bundler#external

richpjames commented 2 months ago

This doesn't seem to work, we get the following error in Chrome TypeError: Failed to resolve module specifier "socket.io-client". Relative references must start with either "/", "./", or "../".

yndajas commented 2 months ago

This doesn't seem to work, we get the following error in Chrome TypeError: Failed to resolve module specifier "socket.io-client". Relative references must start with either "/", "./", or "../".

This confused me too, but I think it's because we import io from Socket.IO. import { type Socket, io } means import the Socket type but io for real. I misread it for a while!