sbtscala.js

How can you split scalajs cross-project modules (js, jvm, shared) into subprojects?


I'm trying to set up scalajs project using sbt, and since I will be including a "shared" module that will be used by both the jvm side of the project (server) and the js side (web client), I plan to use sbt-scalajs-crossproject. The problem is that I would like to separate part of the js code from the rest to publish as a library (all of the reusable js components). This would require splitting the js part of the project into multiple subprojects. Is this possible?


Solution

  • The best solution I have found is to put the reusable components in a separate scalajs subproject which is published as a distinct module. The rest of the code then goes into a cross-project which depends on the scalajs components project.