Room Error. (SOLVED)
-
I upgrade to 0.9.1, and I have this problem:
TypeError: Class constructor Room cannot be invoked without 'new'
where I got the error:
export class ChatRoom extends Room {
Can you help me ?
Thank you
-
Hi @rscata, this is a pretty weird error, indeed. I don't really know the reason why it happens.
If you're using TypeScript, you can fix it by setting the
"target"
on yourtsconfig.json
to"es2016"
. (example)If you're using JavaScript, you shouldn't use
babel-node
. (see @TORATORA's case)Hope this helps, let me know if that works for you. Cheers!
-
-
Posting to expand on the answer, was stuck on this one for several hours.
In my project I have a typescript colyseus server and a client which uses typescript, react & webpack.I had
tsconfig.json
in bothserver/
andclient/
directories + a basic one in the project root with justexperimentalDecorators
andesModuleInterop
set totrue
to get things going.I tried setting
target
toES2016
in./tsconfig.json
and./client/tsconfig.json
but that did nothing until I added"include": ["node_modules/colyseus.js/**/*" ]
into the root config. - That helped me.Hope this helps someone down the line.