- Notifications
You must be signed in to change notification settings - Fork3
A Sbt plugin that configures source mapping for Scala.js projects hosted on Github
License
ThoughtWorksInc/sbt-scala-js-map
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
sbt-scala-js-map is a Sbt plugin that configures source mapping for Scala.js projects hosted on Github.
I have some Scala.js libraries hosted on Github (Binding.scala and some private libraries). Then, other Scala.js applications would depend on these libraries. When I debug the Scala.js application in a browser, I want to see the Scala source files of the original libraries.
However, by default, the generated*.js.map
files maps the generated JavaScript to the absolute Scala source path where the original library compiled. For me, the path is on a Travis CI worker, like/home/travis/build/ThoughtWorksInc/.../Binding.scala
. The path obviously does not exist on my local computer that debugs the application. Too bad.
This sbt plugin detects if a library is hosted on Github repository and let source map point tohttps://raw.githubusercontent.com/ instead of a local file path.
Browsehttp://todomvc.com/examples/binding-scala/ then open the inspector of your browser. You will be able to debug the Scala.js code in your browser now.
An alternative option is specifying Scala.js's relative source mappings flag.
However, this approach enforce library users cloning the library's source files into their local file system before debugging their applications.
On the other hand, libraries published with this plugin enable the library users to view the source (of correct revision), automatically.
addSbtPlugin("com.thoughtworks.sbt-scala-js-map"%"sbt-scala-js-map"%"latest.release")
Note that sbt-scala-js-map 2.x requires sbt 0.13.x, sbt-api-mappings 3.x requires sbt 1.x.
Execute the release command if you have setupsbt-release correctly。
sbt release
Now switch your Scala.js application to the newly published Scala.js library, build it, browse your web page, and open the debugger in your browser. You will see the Scala source files hosted underhttps://raw.githubusercontent.com/ and you can set break points at code lines in these Scala files.
About
A Sbt plugin that configures source mapping for Scala.js projects hosted on Github
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.