By default, the
-fullopt.js files produced by Scala.js are top-level scripts, and their
@JSExported stuff are sent to the global scope.
Currently, only the CommonJS module format is supported, with the following sbt setting:
Important: Using this setting is incompatible with the (deprecated) setting
persistLauncher := true.
It is also basically incompatible with
jsDependencies; use scalajs-bundler instead.
When emitting a module,
@JSExportTopLevels are really exported from the Scala.js module.
Moreover, you can use top-level
For example, consider the following definitions:
Once compiled under