Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 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
  • Aug 02 14:09
    sjrd edited #407
  • Aug 02 14:04
    sjrd labeled #407
Ashkan Kh. Nazary
@ashkann

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
@cquiroz
0.21.0-RC1 should be on its way to maven central
Binh Nguyen
@ngbinh
:clap: thanks @cquiroz
vonchav
@voonchav_gitlab
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
@ashkann
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
@cquiroz
I think you need to try 0.21.0-RC1
It is 2.12 as sbt plugin all use scala 2.12
Colin Yates
@yatesco
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
@wiggly
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
@sjrd
1 reply
zoombinis
@zoombinis

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?

https://webpack.js.org/api/module-methods/#magic-comments

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

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?

cquiroz
@cquiroz:matrix.org
[m]
You can code split in scala.js but it is not supported by scalajs-bundler
evbo
@evbo

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?
cquiroz
@cquiroz:matrix.org
[m]
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
evbo
@evbo
@cquiroz:matrix.org very cool. Do you have any OSS you can share that uses that approach?
cquiroz
@cquiroz:matrix.org
[m]
You can see the demo part of this facade
evbo
@evbo

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!

zoombinis
@zoombinis

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
./node_modules
./src-tauri
./package.json

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

zoombinis
@zoombinis
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
@Quafadas
I'm getting this message from a project with scala JS bundler...
Unsupported webpack major version 4
4 replies
project.sbt
addSbtPlugin("ch.epfl.scala"               % "sbt-scalajs-bundler"      % "0.20.0")
zoombinis
@zoombinis
This message was deleted
Alexis Hernandez
@AlexITC
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
@AlexITC
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
@Fabszn
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
@julienrf
Hello! It seems the website shows a wrong version number for scalajs-bundler: 0.0.0+1-d083e6df-SNAPSHOT
evbo
@evbo

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
@max-peroch

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