xxshady / altv-esbuild

Hot reload (without reconnect and restart of the server) ✨
https://xxshady.github.io/altv-esbuild
38 stars 3 forks source link

Reloading resources without altv-server connection - esbuild #22

Closed Ymaril closed 9 months ago

Ymaril commented 9 months ago

I wanted to deploy altv-server for local development in Docker. And I'm having trouble net connecting altv-server-inject to my esbuild server.

The problem would be solved by being able to specify the host of the esbuild server.

But I thought, why is this connection needed at all? Altv server itself can monitor resource updates and reload them on the fly.

I tested fs.watch too

import fs from "fs";

fs.watch('./resources/chat/server/index.js', (eventType, filename) => {
  alt.log(filename + ' changed');
});

And it works.

You can tie a resource reloading to this.

This can even be packaged as a separate resource for reloading resources. And use it in esbuild

xxshady commented 9 months ago

But I thought, why is this connection needed at all?

in previous iteration of this esbuild plugin i exactly used fs.watch but it did not work well so in current iteration esbuild callbacks are used

i can add hotReloadServerHost option similar to hotReloadServerPort