Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • 07:40
    julienrf commented #293
  • Dec 04 19:38
    Lasering commented #293
  • Nov 24 05:50
    unarist commented #350
  • Nov 23 00:22
    evbo commented #350
  • Nov 23 00:03
    evbo commented #350
  • Nov 22 22:48
    ngbinh commented #359
  • Nov 22 19:14
    evbo commented #359
  • Nov 20 18:10
    bblfish commented #350
  • Nov 20 18:10
    bblfish commented #350
  • Nov 04 15:24
    mkotsbak commented #359
  • Oct 24 00:47
    scala-steward opened #410
  • Oct 12 08:26
    armanbilge opened #409
  • Oct 05 12:17
    Jaystified commented #350
  • Oct 04 00:33
    ansvonwa commented #402
  • Oct 01 08:59
    mathieuleclaire commented #59
  • Aug 17 16:31
    giabao synchronize #408
  • Aug 17 15:54
    giabao opened #408
  • Aug 14 15:48
    garhirunrat commented #2
  • Aug 08 20:10
    zoombinis commented #406
  • Aug 08 17:09
    zoombinis commented #406
There needs to be, but someone has to step forward to do the work
This is pending that a set of sonatype credentials and pgp keys are setup to publish
the credentials need permissions to publish under scala center
Wow. Maybe @voonchav_gitlab can use jitpack meanwhile?
What is new in 0.21.0-RC1?
For one, I think RC1 supports Webpack 5, because this PR was merged: scalacenter/scalajs-bundler#390
Robert Walker
Hi, is it possible to use a local npm package with the plugin? Experimenting with wasm and trying to use the resulting module in a ScalaJS application.
I am having some problems getting tailwind to purge. Does scalajs-bundler set the NODE_ENV variable (i'm not even sure if this is the problem, but trying to eliminate causes)? When i set it prior to launching sbt, webpack fails:
$ NODE_ENV=production sbt "clean;build"
[info] Full optimizing /home/jw/projects/server/customer-frontend/target/scala-3.0.0/customer-front-end-opt
[error] internal/modules/cjs/loader.js:985
[error]   throw err;
[error]   ^
[error] Error: Cannot find module '/home/jw/projects/server/customer-frontend/target/scala-3.0.0/scalajs-bundler/main/node_modules/webpack/bin/webpack'
[error]     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
[error]     at Function.Module._load (internal/modules/cjs/loader.js:864:27)
[error]     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
[error]     at internal/main/run_main_module.js:18:47 {
[error]   code: 'MODULE_NOT_FOUND',
[error]   requireStack: []
[error] }
[error] Failure on parsing the output of webpack: No content to map due to end-of-input
[error]  at [Source: java.lang.ProcessImpl$ProcessPipeInputStream@6cc42393; line: 1, column: 0]
Just found you can force purging without having to rely on the env var: https://tailwindcss.com/docs/optimizing-for-production#enabling-manually. Did not solve my problem. My css file is still ~3MiB
Ashkan Kh. Nazary

Hello everyone. Trying to do the simplest possible scala-js-bundle that I can think of. When I add an @JSExportTopLevel("addClickedMessage") to any method (even an empty method) then this error appears on the browser's console :

Main.scala:18 Uncaught ReferenceError: exports is not defined

Searched everywhere to no avail. Thanks.

Carlos Quiroz
0.21.0-RC1 should be on its way to maven central
Binh Nguyen
:clap: thanks @cquiroz
Thanks @cquiroz. I've tried out 0.21.0-RC1 with Webpack5. I'm getting this issue on both fastOptJs and fullOptUs: scalacenter/scalajs-bundler#338. I don't have this problem with 0.20.0 and webpack4.
Also, does 0.21.0-RC1 support fastLinkJS and fullLinkJs now?
Ashkan Kh. Nazary
Hello everyone :wave: following the docs I'm getting an error about this new "0.0.0+1-d083e6df-SNAPSHOT" ... the old one (0.20.0) works fine though:
[error] (update) sbt.librarymanagement.ResolveException: Error downloading ch.epfl.scala:sbt-scalajs-bundler;sbtVersion=1.0;scalaVersion=2.12:0.0.0+1-d083e6df-SNAPSHOT
[error]   Not found
[error]   Not found
[error]   not found: https://repo1.maven.org/maven2/ch/epfl/scala/sbt-scalajs-bundler_2.12_1.0/0.0.0+1-d083e6df-SNAPSHOT/sbt-scalajs-bundler-0.0.0+1-d083e6df-SNAPSHOT.pom
[error]   not found: /Users/ashkan/.ivy2/local/ch.epfl.scala/sbt-scalajs-bundler/scala_2.12/sbt_1.0/0.0.0+1-d083e6df-SNAPSHOT/ivys/ivy.xml
[error]   not found: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/ch.epfl.scala/sbt-scalajs-bundler/scala_2.12/sbt_1.0/0.0.0+1-d083e6df-SNAPSHOT/ivys/ivy.xml
[error]   not found: https://repo.typesafe.com/typesafe/ivy-releases/ch.epfl.scala/sbt-scalajs-bundler/scala_2.12/sbt_1.0/0.0.0+1-d083e6df-SNAPSHOT/ivys/ivy.xml
[warn] Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? (default: r)
one probable pointer is the scala version in the error message (2.12) while I'm using 2.13.6 everywhere !
Carlos Quiroz
I think you need to try 0.21.0-RC1
It is 2.12 as sbt plugin all use scala 2.12
Colin Yates
morning all - newb, but how do I configure scalajs-bundler to execute SCSS and optimise the images/CSS (e.g. create an image sprite/rewrite CSS). I know "use webpack" :-) but I've not had enough coffee and failing to see how to plug that in. This is such a common usecase - do you know of any public examples? Thanks!
Nigel Rantor
On the off-chance that my google-fu just fails me I have a question. I know that the scalajs-bundler system doesn't deal with HTML/assets. I am wondering if there is an all-in-one SBT plugin that does deal with this though, probably using scalajs-bundler under the covers for the JS library part. I have been looking for a while now after getting to the stage where I really want my dev env to have a quicker cycle time and I'm no closer to seeing anything.
3 replies
Sébastien Doeraene
1 reply

Hi, love this lib! Trying to implement code splitting using Webpack's "magic comments" but are all comments getting stripped away by scalajs optimization before webpack sees them?


oh... maybe this isn't supported yet?: scalacenter/scalajs-bundler#2

Hi, I too am curious, is it possible to code split?

My electron app built with scalajs bundler is getting slow to load, I need to code split so imports are gradually made.

Any way forward on code splitting?

You can code split in scala.js but it is not supported by scalajs-bundler

thanks @cquiroz:matrix.org , so then the only option I presume is to separate "modules" by different sbt subprojects - each one running scalajs bundler separately?

If that is the only workaround, how then do I reference the individually bundled so that my "main" subproject is able to progressively load them?

off the top of my head, I know how to tell sbt to go fetch files out of target directories, so i could manually grab the bundled modules, and then I presume my webpack config for the "main" subproject would need to say: also include these bundled js files?
I’m doing without using scalajs-bundler actually, I just generate the modules with sbt and then use vite to the “bundlinG” though that’s not really the correct concept for vite
@cquiroz:matrix.org very cool. Do you have any OSS you can share that uses that approach?
You can see the demo part of this facade

very cool, so you run scalajsbunder as usual and then from inside the scalajs bundler/main folder underneath target you simply run npm buildand that triggers your vite build?

If that's all there is to it that's way simpler than creating separate subprojects!


curious, why does scalajsbundler output everything into just a "main" folder? I'm working with Tauri, and it expects code layout something along the lines of:

./dist    <- all bundled js/assets in here

Is there a way or interest in supporting configuration for a dist folder separate from package.json? A flat layout unfortunately leads to buggy behavior so I am generating this layout manually with a script after running scalajs bundler

e.g., here is my manual approach after bundling:
  cd client/target/scala-2.13/scalajs-bundler/main/ && \
  mkdir --parents ./build &&
  rsync --archive --human-readable --progress --remove-source-files \
    --exclude=build \
    --exclude=node_modules \
    --exclude=package*json \
    --exclude=webpack \
    * ./build/
Simon Parten
I'm getting this message from a project with scala JS bundler...
Unsupported webpack major version 4
4 replies
addSbtPlugin("ch.epfl.scala"               % "sbt-scalajs-bundler"      % "0.20.0")
This message was deleted
Alexis Hernandez
Quick question about the plugin directories, right now, I'm depending on some files that are pulled from npm, I had to hardcode the directory but there is likely a way to get it from the scalajs-bundler plugin, I started looking to the source code but I'm posting just in case someone has the answer:
(ThisBuild / baseDirectory).value / "target" / "scala-2.13" / "scalajs-bundler" / "main" / "node_modules" / "custom-protos"
Alexis Hernandez
After playing a bit with it, I wasn't able to get the full path from a value, while the npmInstallDependencies task returns the node_modules directory, I need the directory as an input for a Setting, a Setting can't depend on a Task, hence, I ended up writing this:
(npmUpdate / crossTarget).value / "scalajs-bundler" / "main" / "node_modules" / "custom-protos"
Fabrice Sznajderman
Hi All
I have, probably, a basic question .. I'm wondering if there is a possibility to change the output directory where the main.js is putted? Many thanks for your help
2 replies
Julien Richard-Foy
Hello! It seems the website shows a wrong version number for scalajs-bundler: 0.0.0+1-d083e6df-SNAPSHOT

using the latest release 0.21.0-RC1, I try to use webpackBundlingMode in fastOptJS set to LibraryOnly

But then only *-fastopt-library.js is emitted and not *-loader.js or *-fastopt.js?

I can work around this by disabling LibraryOnly, but how can I enable it while also emitting those others as it worked in 0.20.0?

Maxime P

Hi there, using the bundler for the first time this week and ran against some warnings when sharing a module between a Play server and a scala.js client. This shared module has a dependency (play-json-derived-codecs), here is what I see :

[warn] WARNING in ./client-fastopt.js
[warn] Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
[warn] Failed to parse source map from '/home/runner/work/play-json-derived-codecs/play-json-derived-codecs/library/src/main/scala/julienrf/json/derived/DerivedOWrites.scala' file: Error: ENOENT: no such file or directory, open '/home/runner/work/play-json-derived-codecs/play-json-derived-codecs/library/src/main/scala/julienrf/json/derived/DerivedOWrites.scala'

Is there anything obvious that I'm missing in my build.sbt? (I can try to share a minimal version to reproduce). Thanks