EXPERIMENTAL: Primitive Long
s *may* be compiled as primitive JavaScript
bigint
s.
EXPERIMENTAL: Primitive Long
s *may* be compiled as primitive JavaScript
bigint
s.
Default: false
Future versions of Scala.js may decide to ignore this setting.
Avoid class
'es when using function
s and prototype
s has the same
observable semantics.
Avoid class
'es when using function
s and prototype
s has the same
observable semantics.
Default: true
SpiderMonkey is known to exhibit terrible performance with JavaScript
class
'es, with up to an order of magnitude of performance degradation.
Setting this option to true
provides a hint to the Scala.js linker to
avoid using class
'es when using other JavaScript features (typically
function
s and prototype
s) has the same observable semantics, in order
to improve expected performance. Setting it to false
provides a hint
not to avoid class
'es. Either way, the linker is free to ignore this
option.
Avoiding class
'es has a negative impact on code size. If the code is
only targeted at engines that are known to have good performance with
class
'es, it is desirable to set this option to false
. If the code
is targeted at browsers (among others), it is recommended to set it to
true
.
This option never affects the code emitted for JavaScript classes
(classes extending js.Any
), since that would have an impact on
observable semantics.
This option is always ignored when useECMAScript2015
is false
.
Avoid let
s and const
s when using var
s has the same observable
semantics.
Avoid let
s and const
s when using var
s has the same observable
semantics.
Default: true
Due to their semantics in JavaScript (their Temporal Dead Zone, TDZ),
let
s and const
s are more difficult for engines to optimize than
var
s. There have been known cases of dramatic performance issues with
them, such as the Webkit issue
https://bugs.webkit.org/show_bug.cgi?id=199866.
Setting this option to true
provides a hint to the Scala.js linker to
avoid using them when using a var
has the same observable semantics, in
order to improve expected performance. Setting it to false
provides a
hint not to avoid let
s and const
s. Either way, the linker is free to
ignore this option.
Using let
s and const
s has benefits for humans writing code as they
help readability and debugging, but there is little to no benefit in
using them when the code is compiler-generated.
This option is always ignored when useECMAScript2015
is false
.
Use ECMAScript 2015 features, such as classes and arrow functions.
Use ECMAScript 2015 features, such as classes and arrow functions.
Default: true
When true
, the following behaviors are guaranteed:
class
'es, therefore a) they can extend
native JavaScript class
'es and b) they inherit static members from
their parent class.NoModule
) mode, top-level exports are defined as let
s
rather than var
s, and behave as such.
ECMAScript features to use when linking to JavaScript.
The options in
ESFeatures
specify what features of modern versions of JavaScript are used by the Scala.js linker.useX
*force* the linker to use the corresponding features, guaranteeing that the specific semantics that they provide will be used.allowX
*allow* the linker to use the corresponding features if it supports them. Support for such options can be dropped in any subsequent version of the linker, including patch versions.avoidX
*hint* at the linker to avoid the corresponding features *when it does not affect observable semantics*. They are related to optimizations (for performance or code size). The linker is free to ignore those options.