The core modules of coursier are cross-compiled and published for Scala.js. This allows to run resolutions from Node.js or from the browser, via Scala.js. Note that only the core module of coursier, running resolutions, is cross-compiled. The cache module is not, so that one cannot rely on the cache of coursier from Scala.js.
As a substitute to the cache module, a module named
fetch-js is published for Scala.js, allowing one to fetch metadata and possibly artifacts via XMLHttpRequests.
From sbt, one can depend on the core and fetch modules via
resolvers += Resolver.sonatypeRepo("snapshots") libraryDependencies ++= Seq( "io.get-coursier" %%% "coursier-core" % "1.1.0-M13-2+1-9bd837ab-SNAPSHOT", "io.get-coursier" %%% "coursier-fetch-js" % "1.1.0-M13-2+1-9bd837ab-SNAPSHOT" )
or simply via the
coursier module, which aggregates both,
resolvers += Resolver.sonatypeRepo("snapshots") libraryDependencies += "io.get-coursier" %%% "coursier" % "1.1.0-M13-2+1-9bd837ab-SNAPSHOT"
As an illustration, coursier has an in-browser demo, that allows one to run resolutions entirely from the browser.