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
Milan Satala
@msatala
Hi guys, I'm pretty sure it was asked and answered before but I'm not able to find it. Is it possible to use Scala.js 1.3+ module splitting in combination with scalajs-bundler?
Sébastien Doeraene
@sjrd
No, it's not possible yet.
We are proposing a project to implement that at GSoC this year (assuming our org gets accepted).
Milan Satala
@msatala
@sjrd Thank you for answering.
On a project where we don't have scalajs-bundler nor module splitting yet we will go the module splitting route since we deploy often and the JS output is quite large.
Sébastien Doeraene
@sjrd
Let us know how it goes. Module splitting is fairly new, and we're eager to hear from practical experiences using it.
Milan Satala
@msatala
Will do. We have 108k lines of scala.js code. My idea is to use module splitting to have a single large js file which contains all "static code" (std lib + other libs) and another file containing our code that changes often.
Milan Satala
@msatala
Looking at dynamic imports compatibility https://caniuse.com/es6-module-dynamic-import we might even go that route and load pages dynamically.
Sébastien Doeraene
@sjrd
For dynamic imports, we have something built-in since 1.4.0 with js.dynamicImport.
Milan Satala
@msatala
Yup, that's what I meant.
Russ White
@russwyte

If I get some time today I plan to PR this change so that developers can override versions of concat-with-sourcemaps and source-map-loader:

    val devDependencies =
      npmDevDependencies ++ (
        if (currentConfiguration == Compile) npmManifestDependencies.compileDevDependencies
        else npmManifestDependencies.testDevDependencies
      ) ++ webpackPackages ++ Seq(
        "webpack-dev-server" -> webpackDevServerVersion,
      ) ++ (
        if (npmDevDependencies.exists{case (name, _) => name == "source-map-loader"}) Seq.empty 
        else Seq("source-map-loader" -> sourceMapLoaderVersion)
      ) ++ (
        if (npmDevDependencies.exists{case (name, _) => name == "concat-with-sourcemaps"}) Seq.empty
        else Seq("concat-with-sourcemaps" -> "1.0.7")
      )

Any thoughts? Is there a more preferred solution? Maybe the same way webpackDevServerVersion is handled?

Carlos Quiroz
@cquiroz
@russwyte Please note that there is a PR to get webpack 5 and that changes the use of source-map-loader etc
Russ White
@russwyte
@cquiroz Thanks! Yes - I saw that PR, but it looked like it was not making progress. I was just hoping maybe I could provide a quick fix. I will pull that WP5 PR down and see if I can contribute there.
cquiroz
@cquiroz:matrix.org
[m]
Publication seems to be failing
I think we may want to try to move to sbt-ci-release and abandon travis once and for all
Philipp Dörfler
@phdoerfler
image.png
Hi! I'd like to use a JS/TS lib which is hosted on github packages instead of npm, I looked through the scalajs-bundler docs and the source and I did find a settingKey for adding additional args to npm, is that how I would do that?
There's no resolver mechanism as there is in sbt where I can add additional maven / ivy repositories, is there?
(I could add this line in a project -wide .npmrc config file, but ideally I'd want to keep everything in my SBT build)
Philipp Dörfler
@phdoerfler
turns out, I can't simply add that line to a project-wide .npmrc because whilst I can install the package with npm myself this way, scalajs-bundler doesn't seem to pick up that config file by itself. Which I'm kinda glad for tbh.
All in all this could probably do with better documentation and I'd file a PR if I knew what to do, but I don't :D
Philipp Dörfler
@phdoerfler

I'm afraid using npmExtraArgs doesn't work either because it adds the args after install:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '--//npm.pkg.github.com/:_authToken',
1 verbose cli   'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef',
1 verbose cli   '--@jensforstmann:registry',
1 verbose cli   'https://npm.pkg.github.com'
1 verbose cli ]

Which npm does not like at all. Full log: https://gist.github.com/phdoerfler/7510a775ce2032576028768b2bfbfcaf

Dan Di Spaltro
@dispalt
@cquiroz:matrix.org it looks like the rc1 for 0.21 didn't work, right?
cquiroz
@cquiroz:matrix.org
[m]
Nope, the release script is failing, I’m trying to move it to sbt-ci-release
Matt Hughes
@matthughes
Any idea what pulls in @types/node? More generally, anyone have example config of how to lock down the versions pulled in by npm? It seems like NPM/JS ecosystem is far more blase about pulling in newer releases via transitive dependencies. Nothing JS in my build has changed for months, but now it’s trying to pull in @types/node:15.0.1 which doesn’t exist in my registry yet.
Matt Hughes
@matthughes
It looks like there is package-lock.json support in latest release but that RC hasn’t actually made it to the repos; can that get pushed?
Mathieu
@mathieuleclaire
Hi,
I use scalajs-bundler and webpack to get plotly.js dependencies on a plotly facade. But to make webpack working with plotly, we need to add a loader (ify-loader) in the config file as described here: https://plotly.com/javascript/getting-started/. Otherwise, at runtime, I get a "Can't resolve 'fs'". My concern is that I would like to provide a clean facade with a single facade dependency and without any webpack config hack to achieve from the project using the facade. Do you have any idea on how to achieve that ?
1 reply
Artsiom Miklushou
@mikla
@msatala I also have quite huge scala.js project and thinking about module splitting.
Artsiom Miklushou
@mikla
And recently tried scalajs-bundler without any success: it fails with FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory
(25G of ram available)
webpackNodeArgs ++=Seq("--max-old-space-size=24576")
Carlos Quiroz
@cquiroz
I think module splitting requires ES modules which are not supported by scalajs-bundler
nafg
@nafg
Does anyone know if sbt-web-scalajs 1.2.0 works with scalajs-bundler?
vonchav
@voonchav_gitlab
Hello. Is 0.21.0-RC1 available? On github, it seems 0.21.0-RC1 was released back in March. But it failed downloading. Is 0.21.0-RC1 published at all?
vonchav
@voonchav_gitlab
Hi @sjrd @cquiroz:matrix.org, what's the status of scalajs-bundler project? There hasn't been any commit since March 8 and I couldn't find 0.21.0-RC1 artifact. Will there be any new release of this plug-in? :)
nafg
@nafg
There needs to be, but someone has to step forward to do the work
cquiroz
@cquiroz:matrix.org
[m]
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
nafg
@nafg
Wow. Maybe @voonchav_gitlab can use jitpack meanwhile?
What is new in 0.21.0-RC1?
vonchav
@voonchav_gitlab
For one, I think RC1 supports Webpack 5, because this PR was merged: scalacenter/scalajs-bundler#390
Robert Walker
@olofwalker
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.
jenwirth
@jenwirth
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]
jenwirth
@jenwirth
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
@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!