Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 23 2021 09:24
    @sjrd banned @yensaoxuan_twitter
  • Apr 18 2021 19:06
    @sjrd banned @Amitgup48798297_twitter
  • Mar 29 2021 07:47
    @sjrd banned @quangs
  • Jan 23 2021 06:34
    @sjrd banned @Rebeka58_gitlab
  • Jun 08 2020 20:43
    @sjrd banned @sw7240614
  • Sep 29 2019 08:35
    @sjrd banned @8bitpitRBX_twitter
  • May 23 2019 13:44
    @sjrd banned @BIGCRYPTO001_gitlab
  • May 01 2019 14:31
    @sjrd banned @Certificates1_gitlab
  • Apr 22 2019 15:31
    @sjrd banned @lerbatax
  • Jan 31 2019 23:04
    sjrd commented #3555
  • Jan 31 2019 22:56
    sjrd review_requested #3555
  • Jan 31 2019 22:56
    sjrd opened #3555
  • Jan 31 2019 21:06

    sjrd on 0.6.x

    Remove dead code: specific coll… Adapt the signature of `js.Arra… Merge pull request #3554 from s… (compare)

  • Jan 31 2019 21:06
    sjrd closed #3554
  • Jan 31 2019 20:54
    erikvanoosten commented #2665
  • Jan 31 2019 16:33
    sjrd commented #3538
  • Jan 31 2019 15:54

    sjrd on master

    Fix analyzer cycle detection to… Add toString methods to analyze… Do not provide linked ClassInfo… and 1 more (compare)

  • Jan 31 2019 15:54
    sjrd closed #3552
  • Jan 31 2019 15:54

    sjrd on master

    Remove Logger.success It is un… Make level helpers final Clean-up ScalaConsoleLogger cod… and 1 more (compare)

  • Jan 31 2019 15:54
    sjrd closed #3553
Sébastien Doeraene
@sjrd
But in a dev context, it's likely slowing you down.
Martijn
@martijnhoekstra:matrix.org
[m]
Ah, thanks
Objektwerks
@objektwerks
With scalajs 1.5, in a crossproject, using fullOptJS/fullLinkJS, is the former sharedjs-opt.js merged into js-opt.js? Using fastOptJS/fastLinkJS separate main.js files, in js and shared subprojects, are generated.
Sébastien Doeraene
@sjrd
@objektwerks Could you elaborate? There's no such thing as a "shared subproject" when just using a cross project. A cross project is only sugar for two projects: a JVM one and a JS one. There's a shared source directory, but no shared project.
Objektwerks
@objektwerks
@sjrd I've always used a shared subproject to share .js and .jvm js and classes between the js and jvm projects. Did that change recently? Here's an example project: github.com/objektwerks/scalajs.pool. Some time ago, js-opt.js and shared-opt.js files were generated from a fullOptJS. That has changed with 1.5 and the module linking feature.
Objektwerks
@objektwerks
I guess I've always viewed the shared crossproject as another subproject. That said, I was just curious why the shared/.js shared-opt.js file is now empty after a fullOptJS/fullLinkJS. Hence the merge shared/.js into js/js-opt.js question.
Sébastien Doeraene
@sjrd
If you have a non leaf project, its JS files are empty (except for boilerplate), and so calling any of the linking methods on them is useless.
This has always been true.
It's just that maybe because of aggregation, you were calling linking methods of the shared stuff without actually meaning to?
Objektwerks
@objektwerks
Ok. Because I used to specific both js files in my index.html file. So is ALL of the generated JS being placed in the js/js-sbt.js file?
Sébastien Doeraene
@sjrd
Yes.
There was never any reason for you to include both JS files in your html. The shared one contributed nothing useful.
Objektwerks
@objektwerks
Ok, great. I was thinking that - but wasn't sure. :) Thanks, Sebastien! Cheers!
Sébastien Doeraene
@sjrd
Graag gedaan.
Objektwerks
@objektwerks
Dutch, eh? Nice.
Sébastien Doeraene
@sjrd
I'm Belgian so I speak some Dutch, yes.
Joel Moberg
@joelmo
"starting from 45kB gzipped for a full application." 45kB gzipped is heavy but maybe alot of libraries are included? In haxe I can create libraries that start from ~7kB gz then I have IO function and http client and some more.
It's also before minified..
Sébastien Doeraene
@sjrd
I'm afraid the 45 KB don't include much of libraries. It's, unfortunately, mostly the Scala collections. It's the price to pay to get full Scala.
Haxe plays a different game.
Joel Moberg
@joelmo
I will stay with have then. Thanks for answering.
Objektwerks
@objektwerks
How can I modify the fast/fullLinkJS output directory name. For instance, in lieu of js-opt or js-fastopt, I might want to name both js for the sake of consistency. I've attempted to set scalaJSLinkerOutputDirectory, but with no success.
Sébastien Doeraene
@sjrd
It's that setting, but it needs to be scoped in Compile / or Test /
Objektwerks
@objektwerks
Ok, let me try that.
Sébastien Doeraene
@sjrd
That said, if you make both fastOpt and fullOpt point to the same location, you'll confuse sbt's change detection mechanisms, and things can go wrong (either recomputing things too often or not often enough).
Objektwerks
@objektwerks
Ok. I've tried this fastLinkJS / scalaJSLinkerOutputDirectory := file("js") with no success.
Sébastien Doeraene
@sjrd
Compile / fastLinkJS / scalaJSLinkerOutputDirectory := file("js")
Objektwerks
@objektwerks
Ok. I got this to work Compile / fastLinkJS / scalaJSLinkerOutputDirectory := target.value / public / "dev" I tried you way, but the linker got a bit lost in terms of directory location. All I can say is - sbt is an art. :)
Sébastien Doeraene
@sjrd
Once you learn to use show, inspect and above all inspect tree, a lot of things become much easier.
Objektwerks
@objektwerks
Ok, thanks for the tip, Sebastien!
Sébastien Doeraene
@sjrd
For example, inspect proj/fastLinkJS directly tells you that it depends on proj / Compile / fastLinkJS / scalaJSLinkerOutputDirectory, among other things.
Objektwerks
@objektwerks
@sjrd Yeah, sbt inspect and show provide a bit of info.:)
Carlos Quiroz
@cquiroz
Finally got around to use dynamic ES imports with scala.js
Works great, thanks @sjrd and the team for this awesome feature
Sébastien Doeraene
@sjrd
It's mostly @gzm0 in this case 😉
Martijn
@martijnhoekstra:matrix.org
[m]
Is there a way to get a stack trace from a running scalajs program on node a la jstack?
I see there is a way to connect a debugger, maybe that's a fruity approach. Is there anything already there in any of the usual tooling for attaching debuggers (maybe even with sourcemaps)?
Naftoli Gugenheim
@nafg
Is there a benefit of sbt-crossproject over sbt-projectmatrix?
Sébastien Doeraene
@sjrd
sbt-projectmatrix is a generalization of sbt-crossproject.
That said, it creates even more projects in the build, so it can slow it down.
Naftoli Gugenheim
@nafg
@sjrd is that true even for only one scala version, or do you mean that it creates a project per scala version?
Do you mean it slows it down by taking longer to load the build (more settings for sbt to process), or that if it's compiling two scala versions in parallel that can be slower than just one (but still might be faster than compiling the same scala versions via ++)
Sébastien Doeraene
@sjrd
It creates one project per Scala version, yes. It's typically pointless to use project matrix if you don't have multiple Scala versions.
And yes it makes the build slower to load.
Naftoli Gugenheim
@nafg
That's sbt's major issue still, it seems to be slowed by the huge number of settings it proliferates. And Mill still doesn't seem to have enough plugins for me to switch to it
Mathieu
@mathieuleclaire

Hi,
I am building for a while my scala-js application at runtime because my application is pluggable. I have to be abble to add plugins at runtime or restart the application including new plugins. It use the Linker methods to achieve this (see sources here: https://github.com/openmole/openmole/blob/13-dev/openmole/gui/server/org.openmole.gui.server.jscompile/src/main/scala/org/openmole/gui/server/jscompile/JSPack.scala).

Until now, I dealt with my js lib dependencies by hand, merging js deps in a big js file. But I had often js loading or depencies resolution issues. So I try to use webpack, which is pretty straight forward when everything is compiled and linked from the sbt file. But not really in my case.

My idea was to
1) fastOptJS / webpack an empty project, which depends on the same dependencies as my application (and just calling a couple of fake methods to trigger webpack), so that I get a js file resolving all the js dependencies I need for my main project,
2) build my application with fastOptJS (but with no wepback resolution)
3) merge both js in a big one.
4) compress this big js file (if it is possible afterwards)

The problem is that the main method of the main application is not recognized any more, the html body tag remains empty and nothing happens when the html is run.

Any idea on how to solve my problem ? Is the way I do seems to be the good one ?
Thanks

Sébastien Doeraene
@sjrd
Perhaps you lost scalaJSUseMainModuleInitializer := true in the process?
Mathieu
@mathieuleclaire
Nope, I didn't. Actually, for now I test in separate code to evaluate the feasability. So I fastOptJS a scala code containing a main (with the scalaJSUseMainModuleInitializer := true) and I fastOptJS / webpack my empty project on an other hand. But it should lead to the same result, right ?
Mathieu
@mathieuleclaire
Here is my build:
lazy val emptyProject = project.in(file("packJS")) enablePlugins (ScalaJSBundlerPlugin) dependsOn(ace, bootstrapnative, tools, highlightjs)

lazy val runBootstrapDemo = taskKey[Unit]("runBootsrapDemo")
lazy val bootstrapDemo = project.in(file("bootstrapDemo")) enablePlugins (ScalaJSBundlerPlugin) settings(
  sourceCode,
  scalaJSUseMainModuleInitializer := true,
  runBootstrapDemo := {
    val demoResource = (resourceDirectory in Compile).value
    val deps = (fullOptJS / webpack in emptyProject in Compile).value.head.data
    val jsBuild = (fullOptJS in Compile).value.data

    IO.copyFile(merge(jsBuild, deps), target.value / "js/demobootstrapnative.js")
    IO.copyDirectory(demoResource, target.value)

  }
) dependsOn(ace, bootstrapnative, tools, highlightjs)


def merge(f1: File, in: File) = {
  val from = java.nio.file.Files.lines(in.toPath)
  val bw = new BufferedWriter(new FileWriter(f1))
  from.forEach { p => bw.append(p + "\n") }
  bw.close
  f1
}
Sébastien Doeraene
@sjrd
Does any exception appear in the browser console?
I think your setup will be problematic at least because emptyProject, having no main method, will dead-code-eliminate everything, including its imports from other modules. That in turn will cause Webpack to think that you're not referencing any extra library.