Questions tagged [scalajs-bundler]

Questions related to scalajs-bundler.

is a module bundler for projects that use packages.

You can find more information on the GitHub repo : https://scalacenter.github.io/scalajs-bundler/

38 questions
6
votes
1 answer

Will Scala.js ever produce small bundles?

While I love Scala the language, and Scala.js the project, I'm a little put-off by the size of the eventual JS bundle, even in fullOptJS mode. My immediate need is to create a small-ish library for use in the browser. >150kb is a big ask, and…
vivri
  • 885
  • 2
  • 12
  • 23
5
votes
0 answers

scalajs-bundler choking on source map URLs prefixed with local path, e.g. './http...' source files when running fastOptJS::startWebpackDevServer

I have a ScalaJS project and running the sbt command fastOptJS::startWebpackDevServer in Windows 10 yields errors like in the following snippet: [error] (Emitted value instead of an instance of Error) Cannot find source file…
Zachary Albia
  • 71
  • 2
  • 7
4
votes
2 answers

How to break down the size of scala.js JS output

There exist a few webpack bundle analysis scripts that show a list of included modules along with their sizes. However, Scala.js emits one big module for all the Scala code, so those tools can't look into it. As both a library author and an end user…
Nikita
  • 2,924
  • 1
  • 19
  • 25
3
votes
0 answers

WDS Warnings while compiling

If I define a bare scalajs build.sbt as below with no actual scala code (App is an empty class): enablePlugins(ScalaJSBundlerPlugin) lazy val repro = project.in(file(".")).settings( name := "Repro", scalaVersion := "2.12.8", …
user79074
  • 4,937
  • 5
  • 29
  • 57
2
votes
0 answers

Testing using scalatest for Scala.js and Slinky

I'm trying to create a react-native app using slinky and am trying to run tests using the scala.js port of scalatest. Simple situation where the deps look like this in build.sbt scalaVersion := "2.13.8" libraryDependencies += "me.shadaj" %%%…
arinray
  • 178
  • 1
  • 12
2
votes
2 answers

scalaks-bootstrap: Uncaught ReferenceError: exports is not defined at scalajsenv.js:29

I try to make a simple scalajs + scalajs-bootstrap application, but there is few documentation on how to set up the skeleton. The scalajs-bootstrap project has an example, but the build.sbt file is very big and it contains both the source code of…
David Portabella
  • 12,390
  • 27
  • 101
  • 182
2
votes
1 answer

How to use JSImport when writing scalajs facade for javascript modules

I have written a facade using JSImport, and it works. Unfortunately, I arrived at the solution through trial and error, and I don't fully understand why this particular solution works but others I tried did not. Background: I'm starting with a…
Tim Ryan
  • 1,010
  • 2
  • 11
  • 19
2
votes
1 answer

In Play, how to copy js files from ScalaJS client to server?

I'm trying to write an app that's part ScalaJS and part Play framework. I'm using the ScalaJS bundler. It's bundling my JavaScript fine and I can see the resulting files where they are supposed to go. But I noticed that only client-jsdeps.js and…
eje211
  • 2,385
  • 3
  • 28
  • 44
2
votes
2 answers

Can JSweet viably port Java libraries for use in cross-built Scala.js projects?

In the search for ways to make Java libraries accessible to both the JavaScript and JVM sides of Scala.js cross-built projects, please consider the following experiment: Imagine that a Scala.js project needs advanced matrix math capabilities such as…
Ben McKenneby
  • 481
  • 4
  • 15
2
votes
0 answers

scalajs-bundler to include with jQuery plugin

I am using this jQuery modal dialog plugin with jQuery facade. It was working until I decided to change from jsDependencies to Webpack using scala-bundler. The Webpack generated bundle custom Javascript didn't include the modal dialog script. It…
thlim
  • 2,908
  • 3
  • 34
  • 57
2
votes
1 answer

How do I set a javascript global variable to a module with ScalaJS Bundler

I am using Scalajs-Bundler to manage NPM dependencies for my Scala.js project. I am trying to use scalajs-react-components to provide Scala.js facades for Material-ui components, but the library requires a global variable mui defined as follows: var…
Trevor Giddings
  • 387
  • 1
  • 4
  • 17
1
vote
1 answer

Facing ReferenceError while running tests with ScalaJS Bundler

I am facing this issue when upgrading from sbt-scalajs 0.6.x to 1.2.0 and the issue is:- With sbt-scalajs v0.6.26 (and sbt-scalajs-bundler v0.14.0), I have enabled the jsdom support for tests: requireJsDomEnv in Test := true And test suites are…
himanshuIIITian
  • 5,985
  • 6
  • 50
  • 70
1
vote
1 answer

scalajs-env-jsdom-nodejs run fails with UnsupportedInputException

I'm trying to put together a very simple project. It compiles, but when I try to run it, it fails with: [error] org.scalajs.jsenv.UnsupportedInputException: Unsupported input:…
esgott
  • 78
  • 8
1
vote
2 answers

How to include bootstrap with scalajs-bundler

I am using the scalajs-bundler plugin and have defined my build.sbt thus: enablePlugins(ScalaJSBundlerPlugin) name := "Reproduce" scalaVersion := "2.12.8" npmDependencies in Compile += "bootstrap" -> "3.4.1" However when I run "sbt…
user79074
  • 4,937
  • 5
  • 29
  • 57
1
vote
1 answer

Can the sbt-crossproject plugin support two Scala.js builds with two separate main classes, both with output managed by the scalajs-bundler plugin?

Suppose that you have a Scala.js project that compiles meaningfully to browser JavaScript, Node.js, and JVM. Now imagine that in the browser, part of the application runs in the window while another part runs in a web worker. Can SBT bundle two…
Ben McKenneby
  • 481
  • 4
  • 15
1
2 3