node.jsscalacommand-linesbtscala.js

Scala.js - pass command line arguments from SBT run


When running the app using the sbt run while developing normal JVM app, I can pass command line arguments using run <args>. When I try the same with Scala.js, I get an error "No valid parser available". When trying runMain variant like runMain Main.main arg, the error is "Expected non-whitespace character", with arrow pointing just behind Main.main.

Is there some way how to pass arguments to the Scala.js / Node.js application when running it from SBT?

(I am using Scala.js 0.6.15).


Solution

  • No, there isn't, because JavaScript does not have a notion of command-line arguments. Node.js does, but only if started from the command-line, and that use case is not supported by the sbt plugin, I'm afraid.

    Feel free to file a feature request. I'm not sure it can be accommodated, but we can look into it eventually.