Problem with importing colyseus.js in the frontend.
-
Hi, I'm not sure how to import colyseus.js in the frontend of my project. In the docs, it says to use
import * as Colyseus from "colyseus.js";
, but it gives me an unexpected token * error. In addition, I'm not sure where the colyseus.js library would be coming from. Could someone explain how you are supposed to import this? Thanks!
-
Hi @mdmarshmallow,
If you're not using
webpack
to build your front-end, you can simply grab thecolyseus.js
file from here into your project: https://github.com/colyseus/colyseus.js/tree/master/distThere's no need to
import
this way, since it will be available globally, example:var client = new Colyseus.Client("ws://localhost:2567");
Cheers
-
@endel Thank you, that worked for me. This is a really cool framework by the way!