Performance variable is undefined on cloud (solved)

While trying to host my server code on Colyseus Arena, I've come up with a problem - I can't use performance.now() because it is undefined. Although it works fine on local server.

For illustration I took a simple server template and put logging of performance.now() in onJoin method
0_1647449205079_d95015ed-7ea7-4299-91d5-3d30aceea4d9-image.png

And with a simple client that just joins the room I have a following log
0_1647449533063_fc0506aa-ce2a-4ecf-a5c7-73676aa468c9-image.png

Is there any idea why it could be the case? Is there any workaround?

Hi,
I think performance() is based on OS, please try to import it first:

import { performance } from 'perf_hooks';

and then use it as usual.

console.log("test: " + performance.now());

0_1647521986162_8817a69c-10e3-4019-aec7-02cd1ade0dad-image.png

@coco thank you very much!
The thing I didn't mentioned in initial post is that performance is used by third party module - box2D. And one can't import there
And with your advice I've end up adding it to to the global scope in my arena.config

0_1647954984516_38132dc0-2b5c-474e-a10a-2c6955be5ec5-image.png