-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relative path to source file in sourcemap is broken sometimes #3135
Comments
Thanks for the report. I can indeed reproduce this. The reliable way to reproduce it is to start sbt (or scala-js/sbt-plugin/src/main/scala/org/scalajs/sbtplugin/ScalaJSPluginInternal.scala Line 211 in 7245687
It is incorrect because getParentFile will return a path without a trailing / . Then, .toURI fixes it with a trailing / but only if the file already exists and is a directory. Since this line of code is evaluated at the time sbt is loaded, it will do the wrong thing if target/scala-2.11 does not exist at that time.
The fix is to ensure that there is a trailing |
In fact, there is an even better way: don't use |
@glmars Workaround that you can use right now: scalaJSLinkerConfig := {
val fastOptJSURI = (artifactPath in (Compile, fastOptJS)).value.toURI
scalaJSLinkerConfig.value.withRelativizeSourceMapBase(Some(fastOptJSURI))
} In fact, you'll have to do that in 1.x anyway, because |
… .js file. Instead of the parent directory of the .js file. This solves the issue that the parent directory did not have a trailing `/` in some cases.
[no-master] Fix #3135: Relativize source map URIs against the .js file.
Fixed in 4d8f39a. |
@sjrd, thank you for your attention even to such a minor (for someone) bug. |
I found stable reproduction (see example project https://github.com/glmars/scalajs-wrongsourcemap)
Steps to reproduce
sbt clean fastOptJS
first time./target/scala-2.11/scalajs-wrongsourcemap-fastopt.js.map
, there is such path to source file:sbt clean fastOptJS
second time./target/scala-2.11
sbt clean fastOptJS
I ran into this bug many times when my file manager holds some directories inside
target
andsbt clean
couldn't delete them (but successfully deletes./target/scala-2.11
).The text was updated successfully, but these errors were encountered: