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 your tsconfig.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!

@endel said in Room Error.:


works, thanks.

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 both server/ and client/ directories + a basic one in the project root with just experimentalDecorators and esModuleInterop set to true to get things going.

I tried setting target to ES2016 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.