Is it possible to add a hot reload?
Closed this issue · 6 comments
It would be great to add this plugin https://github.com/xxshady/altv-esbuild
do pnpm dev, theres a hot reload ???
do pnpm dev, theres a hot reload ???
the server is completely reload after changing any file in plugins, it's not a hot reload
It may be possible and it will suck to implement, but everything is built out of a single resource. Rebar does not have the luxury of providing individual plugin reloading, and it would require the entire resource to be reloaded each time.
With all the intricate pieces that Rebar provides beyond just a coding framework, it also provides a lot of WebView changes, script loading changes, and many other features.
This makes hot reloading more complex than what altv-esbuild
is dealing with.
If you need to preview webviews or work with webviews you can do so in the browser with pnpm webview:dev
.
Additionally pnpm dev
is fast enough to do programming if you don't add MLO mods, or simply don't load a ton of mods while working on your scripts.
Usually by the time that you hit CTRL +S, and swap over to your game you'll be about connected in again, if not already connected in again. Hot reload would only save a few seconds of your time.
Scripts (scripts folder) run within 10 seconds before starting the server, and the game unfolds in less than one second. This is not very convenient)
RYZEN 7, RTX2060, NVME
Scripts (scripts folder) run within 10 seconds before starting the server, and the game unfolds in less than one second. This is not very convenient)
RYZEN 7, RTX2060, NVME
If you want to know why it can take up to 10 seconds.
- Transpiles your TypeScript down to JavaScript
- Transpiles webview with Vite into something deployable
- Kills existing server processes
- Copies files like images, resource files, etc. for server usage
- Adjusts path resolving issues in individual files for deployment
- Builds plugin dependency lists for starting plugins, so you don't have to
Then it loads images, webview, and core.
Which takes some time but 10 seconds is not unbearable.
I understand all this)
I just wanted to do it faster, hence the question about hot reload