sjrd on 0.6.x
Remove dead code: specific coll… Adapt the signature of `js.Arra… Merge pull request #3554 from s… (compare)
sjrd on master
Fix analyzer cycle detection to… Add toString methods to analyze… Do not provide linked ClassInfo… and 1 more (compare)
sjrd on master
Remove Logger.success It is un… Make level helpers final Clean-up ScalaConsoleLogger cod… and 1 more (compare)
If you really need the JS library, then you can use any serialization library that cross-compiles for Scala/JVM and Scala.js (most do). What you'll need in addition is how to spawn a process with the JS lib, and how to communicate with it. There, any mechanism to handle IPC would work fine. I can mention https://github.com/scala-js/scala-js-js-envs which is what we use in sbt-scalajs, although it might be overkill for your use case, since it abstracts over several JS engines.
Thanks, that looks exactly like what I was looking for actually!
_sjs. So it's being done manually, but am unsure if we actually want the
take(3)and add it to the artifact that the sbt plugin is including in the build
It might be a bit challenging to define your build if you're starting from scratch :)
After that, it's a matter of running
fastLinkJS for development and
fullLinkJS for a production build.
There's an option of using the scalajs-bundler which maintains a webpack configuration and runs it under the hood in order to produce bundles ready to be shipped into the browser.
I personally prefer to deal with webpack manually (or experiment with other tools), so I'm usually doing something like this: https://github.com/yurique/frontroute-example or this: https://github.com/tulz-app/laminext/tree/main/website (shameless plug :) ).
Having all this in place, I have one terminal tab with sbt
~fastLinkJS and another one with
yarn dev running. And
yarn build for production build (after sbt
Wonder if it would be worthwhile to replace
js.UndefOr with Scala 3 union + extension methods:
extension [A] (a: A | Unit) def isEmpty: Boolean = a == () def isDefined: Boolean = !a.isEmpty def map[B](f: A => B): B | Unit = if a.isEmpty then () else f(a.forceGet) // etc @main def main(): Unit = val a: Int | Unit = 21 println(a.isDefined) println(a.isEmpty) println(a.map(_ + 1))
Doesn't seem possible w/ Null union unfortunately.
scalaJSLinkerConfig.withBatchMode(true). What does this do/change