Skip to content

Update docs about Scala.js #6

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

Open
wants to merge 1 commit into
base: scala-js-mode-validation
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions website/docs/guides/advanced/scala-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ scala-cli Test.scala --js

## Dependencies

This section is currently a work in progress, but here are some initial notes:

- Beware platform dependencies
- `run` / `test` / `package` should all work
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).
Declaring dependencies requires a slightly different format than the usual, the second delimiter is `::` instead of `:`.
E.g. `com.lihaoyi::upickle::3.1.3` instead of `com.lihaoyi:upickle_2.13:3.1.3`:
```bash ignore
scala-cli dep com.lihaoyi::upickle::3.1.3 --js .
```

## Package

Expand Down Expand Up @@ -54,6 +56,19 @@ node hello.js
Hello World from Scala.js
-->

### Optimisation Mode

Scala.js supports different [optimisation modes](https://www.scala-js.org/doc/project/building.html).
To configure them Scala CLI provides both flags and using directives:
- `--js-mode` or `using jsMode` to choose between fastLinkJs and fullLinkJs

| | fastLinkJs | fullLinkJs |
|---------|-----------------------|---------------------------|
| Aliases | fast, fastLinkJs, dev | full, fullLinkJs, release |
| Example | `using jsMode fast` | `--js-mode full` |

- `--js-no-opt` or `using jsNoOpt` to disable optimisation, this will override the mode option

### Module Split Style

### Smallest Modules
Expand Down