scalacenter / scastie

An interactive playground for Scala
https://scastie.scala-lang.org
Apache License 2.0
433 stars 103 forks source link

Scala.js bundler support #197

Open MasseGuillaume opened 7 years ago

MasseGuillaume commented 7 years ago

if jsDependencies is set we should serve those files to the client.

MasseGuillaume commented 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

MasseGuillaume commented 6 years ago

@julienrf I think it would make more sense to use Scala.js bundler here. What do you think?

julienrf commented 6 years ago

But that’s an sbt-plugin. You intend to always add it to Scala.js projects in Scastie?

MasseGuillaume commented 6 years ago

@julienrf Yup. Do you think it could cause an issues?

julienrf commented 6 years ago

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.