-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Support link debug/release for ScalaJS #384
Comments
I will look into contributing this to BSP/Bloop as a first step. |
Thanks for looking into this! I really want it myself, just haven't had the need for these platforms in a while. I originally created #14 for this, so it's been in-flight for a quite a while. Contributing this to BSP should be the preferred option. That way it could (conceptually at least) be shared with scala-cli and others. One particular thing I have noticed which seems unfortunate for us is that bloop seems to treat Also wanted to note that personally I care much more about getting the functionality I do about BSP itself. So if this looks too hard, I'd be ok with another approach as well. Two other options we could explore are: What scala-cli doesbasically what you linked to above Talk to bloop in a non-standard wayBloop already has this functionality (AFAIU), but it's exposed through the bloop cli interface and not through BSP. |
I have opened this: build-server-protocol/build-server-protocol#678 as a start. |
Also something to note: template-js: while this sbt config: produces:
is the key setting here I am guessing. This is a significant difference in bundle-size. The goal should obviously be that bleep produces as small bundles as sbt. This might be a limitation of bloop though? |
So bloop does not support setting modulesplitstyle, however I do not see any reason why it could not be implemented in bloop. I am guessing it just isn't there because before scalajs 1.16 there was no real reason to use esmodules as closure did not support it, as of 1.16 scalajs has it's own minifier for esmodules. |
I think this issue/bug scalacenter/bloop#1304 is still alive. I think this is blocker? You can hack around it by adding a main object with a main method, however I don't think that is an acceptable experience. |
I have opened this scalacenter/bloop-config#87. Depending on if that get merged I think we can look into using BSP. If it's not merged there is no point in using bloop for JS linking as the bundles will be larger than the scala-cli way. I have also talked to @tgodzik about supporting linking through bsp, and he had an idea about using the compile interface with an extra argument to link (--with-linking), I have a rough wip branch adding this to the bloop bsp service. |
nice! Hope we can get that through :) |
Support link debug and release from bloop. this is not exposed through BSP, so there will need to be some bespoke solution or implement support in BSP.
scala-cli has it's own solution for this.
Some files that might be of interest there:
https://github.com/VirtusLab/scala-cli/blob/63db2b1a9c951897dd2b3cd8de01e53024317a76/modules/cli/src/main/scala/scala/cli/commands/package0/Package.scala#L947
https://github.com/VirtusLab/scala-cli/blob/main/modules/options/src/main/scala/scala/build/options/ScalaJsOptions.scala
The text was updated successfully, but these errors were encountered: