Add command to watch for changes #245
Labels
A-Run
Related to the bevy run command
A-Web
Building or running Bevy apps targeting the browser
C-Feature
Make something new possible
D-Complex
Quite challenging from either a design or technical perspective. Ask for help!
S-Needs-Design
This issue requires design work to think about how it would best be accomplished
Add a command like
bevy watch
which runs your Bevy app and will restart it whenever you make changes to the code.The goal here is to speed up the iterative development.
Note that changes to assets should not cause the app to be restarted, as we can use hot reloading there instead. This is the preferred solution, as it's faster and loses less state.
Hot reloading for code is however not (easily) possible at the moment, so we need to restart the app instead.
For the web, we probably need a separate sub-command like
bevy watch web
.We need to ensure that not only the code is recompiled to Wasm, but also bundled again and then the web server restarted.
Finally, the browser should refresh the page, which is the equivalent of restarting the app.
#234 is a per-requisite here.
Implementation
As this is quite the complex topic, we should investigate if we can re-use or wrap a third-party solution here.
A popular tool is
bacon
, which offers a lot of configuration options and might be tailored to our needs.Interesting for us:
background = false
andon_change_strategy = "kill_then_restart"
, to support long-running programs.analyzer = "cargo_json"
, sobacon
can understand our output. We then need to support this output format in the rest of our CLI as well.--config-toml
arg, so we can provide all these configuration options without the user having to set up abacon.toml
file.The text was updated successfully, but these errors were encountered: