Closed murphye closed 2 years ago
Yes, hot reload is possible. I'm currently working on improving the cli support as one of the goals is to reduce the dependency on npm
. Given that es4x
is just a small frontend to vertx and therefore to vertx launcher, you can do hot reload like you would in vert.x.
Imagine you have index.js
with:
print('Hello!')
You can run the script as:
es4x run --redeploy='index.js' index.js
redeploy
is a list of paths to watch, you can point to a folder for example. If you then edit the script you will see something like:
es4x run --redeploy='index.js' js:index.js
Watched paths: [/home/paulo/test/./index.js]
Starting the vert.x application in redeploy mode
Starting vert.x application...
7b3016de-91e2-4d62-a340-4b0a71817972-redeploy
Hello
Succeeded in deploying verticle
Redeploying!
Stopping vert.x application '7b3016de-91e2-4d62-a340-4b0a71817972-redeploy'
Application '7b3016de-91e2-4d62-a340-4b0a71817972-redeploy' terminated with status 0
Starting vert.x application...
7b3016de-91e2-4d62-a340-4b0a71817972-redeploy
Redeployment done in 66 ms.
Hello Again!
Succeeded in deploying verticle
You can also run actions before the redeploy using the --on-redeploy="cmd"
which are useful, say if you're using typescript and need to compile before run.
@pmlopes Can you add to your docs? To a developer hot reload is expected now.
@pmlopes We also need hot reloading in our project. And I found the option --redeploy
is work for a single file but not a folder. Can you provides a docs?
@fanbitian we're about to release vert.x 4.2.4 (hopefuly this week). And I'll update the docs for supporting directories.
If I'm not mistaken, this should already support directories, so it could be a setup/config issue. I'll try to prepare an example to test and use in the docs.
A Node (or even a Java) developer would expect hot reloading of code to be supported. Is this possible with ES4X? I do not see it documented.