Closed evbo closed 1 year ago
I'm running against this too, but using Vite 3:
Sourcemap for "/dev/scala/tyrian-vite-tailwindcss-example/target/scala-3.2.0/app-fastopt/main.js" points to missing source files
But I can't figure out what's going wrong for a long time now...
Trying to run this repo gives a similiar source maps error, though this uses Vite 2.
@sjrd sorry for the ping, but I actually don't know if this is a Vite or ScalaJS issue?
Even if my Main.scala
contains:
package app
import scala.scalajs.js.annotation.*
@JSExportTopLevel("TyrianApp")
object App:
def hello = "hello"
it errors out...
I've since found out that my particular (Linux) browser was expecting source maps in a directory relative to the transpiled js files. I'm not sure why, but found some discord discussions suggesting the following configuration in sbt. Well, it worked for me! This may not work for everyone but please run your devtools in your browser and experiment:
scalacOptions += {
val transpiled = baseDirectory.value.toURI.toString
val to_root = "../../../"
s"-scalajs-mapSourceURI:$transpiled->$to_root/"
}
Wondering if someone else has seen this and found a workaround:
According to github issues, this should have been resolved on Vite's end with their react plugin, so perhaps could this be due to differences in how scalajs libraries have unusual paths for Vite to resolve?
https://github.com/vitejs/vite/issues/5562
I am using: