Erik
06/18/2023, 11:41 AMrun
, but it doesn't start the browser; I have to go to localhost:8080 manually. This is unlike what would happen in a regular Kotlin/JS project, where you run task browserDevelopmentRun --continuous
. So I tried running jsBrowserDevelopmentRun
but that doesn't start the server and instead it runs a web page that lists all kinds of .js and .map files that are probably found on localhost:8080, but there is not index.html file because the server isn't running.
What's the best practice when doing JVM server + JS frontend multiplatform development to run both server and frontend continuously, and open the browser from the Gradle task pointing at the correct page?Robert Jaros
06/18/2023, 11:58 AMindex.html
is generated/served only by the ktor backend, you can add a "dummy" index.html
in your js sourceset resources. This way you will be able to run both webpack dev server (jsBrowserDevelopmentRun
) for frontend development and the ktor backend for server development (with two separate gradle processes from two different consoles). Additionally you can configure webpack to proxy your API calls to the backend endpoints. With some luck you can have hot-reload working on both sides.Erik
06/19/2023, 7:11 AMErik
06/19/2023, 7:11 AMEl Anthony
07/21/2023, 7:04 PM5xry2
07/22/2023, 2:51 PM