Live reload does not seem to work. I make changes,...
# compose-web
m
Live reload does not seem to work. I make changes, save, webpack runs and nothing happens. You have to restart the server for it to work... I running with
jsBrowserDevelopmentRun
The browser just states that no actual changes were detected...
1
b
You need gradle continuous build
./gradlew jsBrowserRun -t
2
m
Thank you @Big Chungus
l
@Big Chungus on the same subject, my project seems to reload twice before actually displaying updates. Do you know what exactly causes this?
b
That's expected. It reloads once due to webpack changes (as described in the original post) and once again once kotlin files are recompiled to js
👍 1
Should be fixable, but looks like kotlin/js teams didn't get to it just yet.
👍 1
l
It's not exactly urgent 😄
b
Yep, it won't be any quicker even if we get rid of first reload since the main blocker is kjs compilation. Just annoying is all.
l
Usually it goes: 1. First reload: Why didn't my div size change? 2. Second reload: Ah, it did
😁 1
n
"I make changes, save" - It does not work for me either. I don't know if it should or not. Although if 1. I build the project (CTRL+F9 in Idea) 2. AND after the build I reload the application explicitly (F5 in the browser) it works. Not fast but works :) Usually there is an automatic reload in the browser between 1. and 2. but to see the changes I have to manually refresh in the browser after the build is finished. So, the development flow is far from perfect but acceptable :)
b
@Norbi you can skip step 1 with gradle continuous builds (same end result just automated)
👍🏻 1
n
"you can skip step 1 with gradle continuous builds" - Yes... But if you have a multi-module project where the backend is also part of the same Idea project then the continuous build is not always practical...
b
Why not? You don;t have to start it from root project. Consider this module structure
Copy code
/root
  /server
  /client
With that then you can start continuous build just for the client via
./gradlew :client:jsBrowserRun -t
n
The problem is with common projects shared by both the client and the server. When I modify common code the continuous build forces the automatic reload of the Spring Boot server application as well which I not always want. (At least as I remember that was the cause why I stopped using the continuous build.)
b
Why wouldn't you want to reload your server if it depends on common code that has changed?
To avoid this, you could start your server from prebuilt fat-jar. That way code changes won't reload it
n
"you could start your server from prebuilt fat-jar" - I'm not sure that Spring Boot live reloading works with pre-built jar but I will try it some day, thanks :)
b
Isn't the point to avoid spring live reloading? Fat jar is means to do exactly that - start server once and disconnect it from source code and gradle that way
225 Views