Closed gpeles closed 3 years ago
I do not think this is the case. FakeXMLHttpRequest
mocks the browser Web API XMLHttpRequest
on node.js. I do not think that Socket.io on node.js requires this API.
Have you imported the @geckosio/phaser-on-nodejs
on the client side? Make sure you only require @geckosio/phaser-on-nodejs
on the server side. Can you please verify this?
I only imported it on the server side
Can you please share your game?
OK I figured it out. The conflict was actually with the Source Map Support module. From their documentation:
The module will by default assume a browser environment if XMLHttpRequest and window are defined. If either of these do not exist it will instead assume a node environment. In some rare cases, e.g. when running a browser emulation and where both variables are also set, you can explictly specify the environment to be either 'browser' or 'node'.
require('source-map-support').install({
environment: 'node'
});
So replacing import 'source-map-support/register'
with the above code solves this.
Closing this issue now.
When a client disconnects, fs.readFile is called with the following url: node_modules/@geckosio/phaser-on-nodejs/lib/internal/process/task_queues.js Then a 'no such file or directory' error is thrown.