sbt-dynscalajs
sbt-dynscalajs copied to clipboard
Add a friendly API to customize the `scalaJSLinkerConfig`
scalaJSLinkerConfig describes the configuration of the Scala.js linker. In sbt-scalajs, this a setting of type StandardLinker.Config, which is easily manipulatable. In sbt-dynscalajs, however, it is an Any, because it needs to be an instance of the StandardLinker.Config loaded from the ClassLoader in dynScalaJSClassLoader. This makes it very hard to manipulate, as can be seen here.
This could be improved using one of two approaches:
- either give it a named abstract type, and pimp the API of
StandardLinker.Configon it using an implicit class, whose implementations would perform the necessary reflection, - or give
scalaJSLinkerConfigthe static typeStandardLinker.Configof the tools loaded in the classpath of sbt, and convert that to aConfigfrom the class loader in the definition ofscalaJSLinker.
The latter might be more pretty, but ties this sbt plugin to forever statically depend on the Scala.js linker artifacts, even if/when in the future that artifact will be decoupled from the js-envs artifacts.