Questions tagged [scala.js]
Scala.js is a Scala to JavaScript compiler deemed production-ready as of version 0.6.0.
scala.js
849
questions
0
votes
1
answer
29
views
Hot Reloading Scala.js
How to hot reload in scala.js application while in development
I am manually reloading the Scala.js application during development. However, I need the ability to reload and immediately reflect the ...
2
votes
0
answers
32
views
Saving date objects in MongoDb from Scala.js
I have a serverless application written in Scala.js that is writing to a MongoDb database. We wrote our own custom integration with the Node.js mongodb driver. Everything is working well except for ...
0
votes
0
answers
32
views
Use a SBT task with different settings from one module
When testing locally, I do not care about code size, therefore I switch GCC off by using following line in my frontend and worker modules settings:
Compile / fullLinkJS / scalaJSLinkerConfig ~= { _....
2
votes
0
answers
38
views
How to allow dynamic interface for a native JS trait in Scala 3?
Following facade trait for three.js works fine with Scala 2:
@js.native
trait Uniforms extends js.Object with Dynamic {
@JSBracketAccess
def update(name: String, uniform: Uniform): Unit
@...
0
votes
0
answers
28
views
How do I run tests in Scala.js using a vite configuration?
The (relatively) new Scala.js vite plugin has made Scala frontend development so much easier than the sbt webpack bundler plugin I had been using previously. Unfortunately, however, I have not been ...
1
vote
1
answer
49
views
Why does Scala multi platform build fails with `Toplevel definition X is defined in ...`?
My multi platform build is failing with an error, that indicates that both JVM and JS dependencies are in the class path. How can this be?
[error] |Toplevel definition EnableReflectiveInstantiation ...
0
votes
0
answers
87
views
Idiomatic way to talk to REST backend from a Scala.js frontend?
I wrote a SPA with Scala.js, where I use a library called RosHTTP in
order to communicate with a REST backend. It helps me add query
parameters, set headers, work with cookies and increase transfer
...
0
votes
0
answers
53
views
How to use ScalaJS-bundler with JsDependencies (WebJars)
I have an existing project with Scala.JS (client) + Play framework*/sbt-web (server). The project uses some WebJars + ProvidedJS, whose are included by jsDependencies ++= Seq(…), using the sbt-...
1
vote
1
answer
181
views
Are there any mill/scala-3/scala.js examples available?
Is there a guide or example somewhere for using mill build tool with scala-3 and scala.js? I saw that the same question had been asked, but implicitly for sbt, and the answer was essentially "it ...
0
votes
1
answer
29
views
Exception using scalajs-bundler Reference to undefined setting: client / npmDependencies
I get the following exception when i start sbt:
[error] Reference to undefined setting:
[error]
[error] client / npmDependencies from client / npmDependencies (/home/sofoklis/workspace/playjs/...
0
votes
1
answer
47
views
sbt-crossproject default project has different scalaVersion than I set. Why?
I'm writing a cross-compiled library between JSPlatform and JVMPlatform using sbt-scalajs-crossproject. I've explicitly set scalaVersion in common settings and yet:
sbt:oatlibxp> show scalaVersion
...
0
votes
1
answer
123
views
Scala.js - How to convert ArrayBuffer to Array[Byte]?
DOM API returns ArrayBuffer but what I need is Array[Byte]. How can I do a conversion?
import scala.scalajs.js.typedarray.ArrayBuffer
def toScalaArray(input: ArrayBuffer): Array[Byte] = {
// code ...
0
votes
1
answer
84
views
Scala.js - How to convert Array[Byte] to Blob?
DOM API requires Blob but all I have is Array[Byte]. How can I do the conversion?
import org.scalajs.dom.Blob
def toBlob(input: Array[Byte]): Blob = {
// code in question
}
0
votes
1
answer
242
views
Decode JSON with Circe and Scala.js
I try to create veeery simple scala.js app. I was following this tutorial https://www.scala-js.org/doc/tutorial/scalajs-vite.html
and I want to decode a json.
Circe
https://circe.github.io/circe/
says
...
0
votes
2
answers
96
views
How to share data between Scala.js test suites?
I share data between ScalaTest suites using a common singleton Object. This works fine when running on JVM, but to my surprise it fails on Scala.js. It seems on Scala.js a fresh instance of the ...