Piotr Krzemiński
12/06/2021, 8:58 AMrun
task) to work properly with reloading on changes. I use react-router. Two problems:
1. Minor: When calling ./gradlew run --continuous
the browser opens on http://localhost:8080/ and displays what corresponds to an unmatched route. Can I configure Webpack through build.gradle.kts somehow so that it opens some real route, like http://localhost:8080/ui/users in my case?
2. Major: when making a change while I'm under /ui/users
, the website reloads but fails with this message in server console: "<e> [webpack-dev-server] [HPM] Error occurred while proxying request localhost:8080/ui/users to http://localhost:8080/ [EADDRNOTAVAIL]"Piotr Krzemiński
12/06/2021, 8:58 AMjs(LEGACY) {
useCommonJs()
browser {
binaries.executable()
commonWebpackConfig {
cssSupport.enabled = true
devServer = devServer?.copy(
proxy = mutableMapOf("/ui/users" to "<http://localhost:8080/>"),
)
}
}
}
Piotr Krzemiński
12/06/2021, 8:59 AMPiotr Krzemiński
12/06/2021, 9:00 AMAssets Report:
Compilation: unnamed
frontend-react.js
main.430e7e2f64785def3978.hot-update.js
main.430e7e2f64785def3978.hot-update.jsonand it's weird there's no index.html which I have placed in src/main/resources. Not sure if related to the problem, though
Robert Jaros
12/06/2021, 9:01 AMhistoryApiFallback = true
to you webpack configuration.Piotr Krzemiński
12/06/2021, 9:05 AM@Suppress("unused")
data class DevServer(
var open: Any = true,
var port: Int? = null,
var proxy: MutableMap<String, Any>? = null,
var static: MutableList<String>? = null,
var contentBase: MutableList<String>? = null
) : Serializable
Piotr Krzemiński
12/06/2021, 9:07 AMRobert Jaros
12/06/2021, 9:07 AMwebpack.config.d
folder.Robert Jaros
12/06/2021, 9:08 AMif (config.devServer) {
// other options
config.devServer.historyApiFallback = true;
}
in webpack.config.d/webpack.js
fileRobert Jaros
12/06/2021, 9:09 AMRobert Jaros
12/06/2021, 9:10 AMPiotr Krzemiński
12/06/2021, 9:16 AMPiotr Krzemiński
12/06/2021, 9:20 AMRobert Jaros
12/06/2021, 9:53 AMPiotr Krzemiński
12/06/2021, 9:54 AM