Closed raquo closed 8 months ago
Ok, thank you @raquo, that really should be fixed! I'll look into it.
I added the sbt-scala-js-map
plugin, which looks like it should take care of things automatically.
We'll see with the next release (coming in a few minutes) whether there's sth else that's missing.
I just released 1.13.0 which should now have source map URLs pointing to github, if the sbt-scala-js-map
really automagically fixed it. I tried inspecting a SJSIR
file content with scalajsp
to somehow see where it's pointing but scalajsp
doesn't appear to actually show this.
Could you check, whether the issues is now fixed, @raquo ?
Thanks! Unfortunately it does not seem that the plugin took effect.
I look at sjsir files in the dumbest way, as binary-plaintext, in IntelliJ. This is a file from borer 1.13.0, note the local file path:
For comparison, this is a file from laminar, with the github path:
I'm guessing you should be able to see the same if you open the sjsir file in a plain text editor.
I'm not sure what the sbt-scala-js-map
plugin needs in your build.sbt to be picked up. I'm using my own snippet because I don't understand how it works, and there isn't much in the readme. But I searched in github to see what people are doing, and maybe you need something like this? https://github.com/nightscape/MetaRx/blob/190aaa6ffe20a1faee88a92629e1abff41073e3f/build.sbt#L56 No idea if that's the case, to be honest.
Ok, I think I found a nice and simple solution that actually works (without the sbt-scala-js-map
plugin).
It'll be published with the next release.
Nice, and thanks for the LocalRootProject
tip, turns out I need it too in one of my libs (that is also cross-platform/multi-module)
The LocalRootProject
incantation is something I found by chance in the monix build.sbt, so the π should actually go to @alexandru.
Thank you, Alex!
π I copied it from somewhere else, but don't remember from where π
@raquo @sirthias @alexandru Thanks a lot to all you!
I used your solutions to fix a similar issue in jsoniter-scala.
Looks like this will become Scala lore, passed around on the hallways, quietly doing it's thing, with the original inventor long forgotten in the mists of time... π
When publishing libraries to Scala.js we're distributing SJSIR files that contain your local paths to the source files. Those paths are used in JS sourcemaps, e.g. to show Scala code in the browser debugger.
The problem is, your local paths don't exist on users' computers, so currently Borer sourcemaps are not possible to resolve:
The typical solution is to rewrite those paths to point to github instead. In my own Scala.js libraries I add a snippet like this to the js project in sbt:
and make sure that
CI
env variable is set when releasing (you can skip that filter, but then you will have source maps pointing to incorrect github URLs if you're testing out a Borer version that isn't (yet) published to github.That snippet needs sbt-git plugin. That snippet so far has worked well, and you can sanity-check that by finding the github URL paths in your library's sjsir files.
There's also https://github.com/ThoughtWorksInc/sbt-scala-js-map but I haven't tried it myself.