Skip to content

Commit 12425cc

Browse files
committed
Update docs about Scala.js
1 parent 88fa24b commit 12425cc

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

website/docs/guides/advanced/scala-js.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ scala-cli Test.scala --js
2323

2424
## Dependencies
2525

26-
This section is currently a work in progress, but here are some initial notes:
27-
28-
- Beware platform dependencies
29-
- `run` / `test` / `package` should all work
26+
Not all Scala libraries have their Scala.js equivalent, to see which of them do consult the [Scala.js documentation](https://www.scala-js.org/libraries/libs.html).
27+
Declaring dependencies requires a slightly different format than the usual, the second delimiter is `::` instead of `:`.
28+
E.g. `com.lihaoyi::upickle::3.1.3` instead of `com.lihaoyi:upickle_2.13:3.1.3`:
29+
```bash ignore
30+
scala-cli dep com.lihaoyi::upickle::3.1.3 --js .
31+
```
3032

3133
## Package
3234

@@ -54,6 +56,19 @@ node hello.js
5456
Hello World from Scala.js
5557
-->
5658

59+
### Optimisation Mode
60+
61+
Scala.js supports different [optimisation modes](https://www.scala-js.org/doc/project/building.html).
62+
To configure them Scala CLI provides both flags and using directives:
63+
- `--js-mode` or `using jsMode` to choose between fastLinkJs and fullLinkJs
64+
65+
| | fastLinkJs | fullLinkJs |
66+
|---------|-----------------------|---------------------------|
67+
| Aliases | fast, fastLinkJs, dev | full, fullLinkJs, release |
68+
| Example | `using jsMode fast` | `--js-mode full` |
69+
70+
- `--js-no-opt` or `using jsNoOpt` to disable optimisation, this will override the mode option
71+
5772
### Module Split Style
5873

5974
### Smallest Modules

0 commit comments

Comments
 (0)