sjrd on 0.6.x
Remove dead code: specific coll… Adapt the signature of `js.Arra… Merge pull request #3554 from s… (compare)
sjrd on master
Fix analyzer cycle detection to… Add toString methods to analyze… Do not provide linked ClassInfo… and 1 more (compare)
sjrd on master
Remove Logger.success It is un… Make level helpers final Clean-up ScalaConsoleLogger cod… and 1 more (compare)
main
method:
js.Dynamic.global.module.exports = { (foo: Int, bar: Int) => foo + bar }
module.exports
.
fullLinkJS
there's nothing more you can do. It's already gone through dce, optimizations, re-dce, and minification.
function $c_
at the beginning of lines will give you the starting offset of each class, which can be a clue.
is there any way to see what is taking up space in my resulting JS file so I could perhaps trim it further?
@darkfrog26 Yes, you can use https://www.npmjs.com/package/source-map-explorer to see how much individual scala classes contribute to your bundle size, it works with scala.js-produced bundles just as well. Example output
➜ laminar-static-gh-pages git:(master) source-map-explorer target/scala-2.13/laminar-static-fastopt/main.js
target/scala-2.13/laminar-static-fastopt/main.js
Your source map refers to generated column 39 on line 363, but the source only contains 38 column(s) on that line.
Check that you are using the correct source map.
java.time
to Scala.js 3.0.0-M3 I ran into the fact that in Scala I can't call an enum
s static method values()
with the parens. I am not sure this is correct based on the fact that I get warning in 2.13
. Discussion is here - https://gitter.im/lampepfl/dotty
sconfig
I use "provided"
so that the end user can pick the java.time
API of their choosing.
This works in Scastie but doesn't when compiled for Scala.js
https://scastie.scala-lang.org/ekrich/utZ047bZRqG48UlVscnbyw/3
When compiling I get the following:
[info] compiling 1 Scala source to /Users/eric/workspace/sjavatime/testSuite/native/target/scala-2.13/test-classes ...
[error] -- [E007] Type Mismatch Error: /Users/eric/workspace/sjavatime/testSuite/shared/src/test/scala/org/scalajs/testsuite/javalib/time/DurationTest.scala:31:9
[error] 31 | for (d: Duration <- samples) {
[error] | ^
[error] |Found: java.time.Duration => Unit
[error] |Required: java.time.temporal.TemporalAmount => Unit
[error] |
[error] |One of the following imports might make progress towards fixing the problem:
[error] |
[error] | import scalajs.js.Any.fromFunction1
[error] | import scalajs.js.ThisFunction.fromFunction1
[error] |
[error] 32 | assertEquals(d.getSeconds(), d.get(SECONDS))
[error] 33 | assertEquals(d.getNano().toLong, d.get(NANOS))
[error] 34 | }
[error] -- [E008] Not Found Error: /Users/eric/workspace/sjavatime/testSuite/shared/src/test/scala/org/scalajs/testsuite/javalib/time/DurationTest.scala:39:16
[error] 39 | assert(!d.isZero)
[error] | ^^^^^^^^
[error] | value isZero is not a member of java.time.temporal.TemporalAmount
I added the type ascription and then it shows me why it won't compile anyway - not the cause.
@Test
methods in traits?