Open MasseGuillaume opened 7 years ago
With Scala.js we can add jsDependencies
: https://www.scala-js.org/doc/project/dependencies.html#depending-on-javascript-libraries
This is really similar to how we serve source map/source code in Scala.js Get the jsDependencies content: https://github.com/scalacenter/scastie/blob/master/sbt-runner/src/main/scala/com.olegych.scastie.sbt/Sbt.scala#L51 Forward it via the runner to the web server: https://github.com/scalacenter/scastie/blob/master/sbt-runner/src/main/scala/com.olegych.scastie.sbt/SbtRunner.scala#L300 Serve it to the user: https://github.com/scalacenter/scastie/blob/master/server/src/main/scala/com.olegych.scastie.web/routes/ScalaJsRoutes.scala#L42 Attach it on the client: https://github.com/scalacenter/scastie/blob/master/client/src/main/scala/com.olegych.scastie.client/components/Scastie.scala#L116
@julienrf I think it would make more sense to use Scala.js bundler here. What do you think?
But that’s an sbt-plugin. You intend to always add it to Scala.js projects in Scastie?
@julienrf Yup. Do you think it could cause an issues?
So far we didn’t provide a backward compatible API (we broke backward compatibility a lot of times). It means that if at some point you want to upgrade the version of scalajs-bundler that is used, existing snippets may be broken.
if jsDependencies is set we should serve those files to the client.