I've been struggling with this for a few weeks now...
# compose-web
m
I've been struggling with this for a few weeks now on an off so finally come to experts for help. I have a compose for web app with WASM target. The problem that I have is I cannot make it work if the URL path is more than 1 deep. Everything works with
<http://localhost:8080/>
and
<http://localhost:8080/path1>
, but fails with
<http://localhost:8080/path1/path2>
. More details in 🧵
index.html
Copy code
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>KotlinProject</title>
    <link type="text/css" rel="stylesheet" href="styles.css">
    <script type="application/javascript" src="composeApp.js"></script>
</head>
<body>
</body>
</html>
webpack.config.d/devserverConfig.js
Copy code
config.devServer = {
  ...config.devServer,
  historyApiFallback: true,
};
When opening
<http://localhost:8080/path1/path2>
I get this error. index.html does load, but wasm app fails
This test is being done on a project generated by Kotlin Multiplatform WIzard
r
You can try adding
<base href="/">
to your
index.html
<head></head>
section.
m
Yes this seems to have did the trick. I will test a bit more later. But THANK YOU so much. I was getting desperate 🙏 thank you color