Skip to content

Source map root added to sources that do not need it #3183

@ptrdom

Description

@ptrdom

I am working on integrating esbuild as a bundler for Scala.js projects (https://github.com/ptrdom/scalajs-esbuild) and I am running into an issue I do not understand.

Scala.js compilation outputs source maps for .js files with entries like these:

[
  "https://raw.githubusercontent.com/scala-js/scala-js/v1.10.1/javalanglib/src/main/scala/java/lang/System.scala",
  "file:///C:/project/src/main/scala/Main.scala"
]

After bundling with esbuild these become:

[
  "../../https://raw.githubusercontent.com/scala-js/scala-js/v1.10.1/javalanglib/src/main/scala/java/lang/System.scala",
  "../../file:///C:/project/src/main/scala/Main.scala"
]

I am guessing that sourceRoot is added to them, and because bundles are located in /www/assets, but the script is executed in project root, it results in ../../ being added. In this case this behavior is not needed, so I am wondering how could I avoid it?

If Scala.js project uses some node_modules, then source map entries do get correctly resolved as, for example, "../../node_modules/lodash/lodash.js", but everything else does not work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions