Skip to content

Commit 2c1f392

Browse files
committed
complete temp steps, refer to stable
1 parent 3deef02 commit 2c1f392

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

src/content/web/wasm.md

+21-6
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ description: Learn how to compile your Dart web app to WebAssembly.
55

66
The Dart team is excited to add
77
[WebAssembly](https://webassembly.org/) as a compilation target when building
8-
Dart and [Flutter]({{site.flutter}}/wasm) applications for the web.
8+
Dart and [Flutter][] applications for the web.
99

1010
Development of WebAssembly support remains ongoing,
1111
which will potentially result in frequent changes.
1212
Revisit this page for the latest updates.
1313

1414
:::note
15-
**Support for Wasm is now in beta!**
15+
**Support for Wasm is now in stable!**
1616

1717
WebAssembly support for Dart web is available on the Dart
18-
*beta* and *main* [channels](/get-dart#release-channels).
18+
*stable* [channel](/get-dart#release-channels).
1919
:::
2020

2121
## WebAssembly support
@@ -37,11 +37,11 @@ restrictions:
3737
## Compiling your web app to Wasm {:#compiling-to-wasm}
3838

3939
We've landed support in the `dart` CLI for invoking the
40-
`dart2wasm` compiler in the Dart and Flutter `main` channels:
40+
Wasm compiler in Dart and [Flutter][]:
4141

4242
```console
4343
$ dart help compile wasm
44-
Compile Dart to a WebAssembly/WasmGC module (EXPERIMENTAL).
44+
Compile Dart to a WebAssembly/WasmGC module.
4545

4646
Usage: dart compile wasm [arguments] <dart entry point>
4747
-h, --help Print this usage information.
@@ -54,7 +54,10 @@ Usage: dart compile wasm [arguments] <dart entry point>
5454
For example: dart compile wasm -Da=1,b=2 main.dart
5555
```
5656

57-
To try Wasm today from the `main` channel:
57+
Wasm compilation is available in stable, but still in preview.
58+
While we continue optimizing tooling to improve developer experience,
59+
you can try compiling Dart to Wasm today
60+
by following the temporary steps outlined here:
5861

5962
1. Start with a web app: `dart create -t web mywebapp`
6063

@@ -64,10 +67,22 @@ To try Wasm today from the `main` channel:
6467

6568
1. Compile with Wasm: `mywebapp$ dart compile wasm web/main.dart`
6669

70+
1. Create a new directory for the built web app: `mkdir site`
71+
72+
1. Copy over Dart code: `cp web/main.* site/`
73+
74+
1. Copy over the web files: `cp web/index.html web/styles.css site/`
75+
76+
1. Create a JS bootstrap file to load the Wasm code:
77+
78+
Add a new file `site/main.dart.js` and fill it with the contents of
79+
this [`main.dart.js` sample](https://gist.github.com/mit-mit/0fcb1247a9444b0cadf611aa5fc6f32e).
80+
6781
1. Serve the output: `dart pub global run ` [`dhttpd`]
6882

6983
You can also check out this small example [here](https://github.com/mit-mit/sandbox).
7084

85+
[Flutter]: {{site.flutter}}/wasm
7186
[`package:web`]: {{site.pub-pkg}}/web
7287
[`dart:js_interop`]: {{site.dart.api}}/{{site.dart.sdk.channel}}/dart-js_interop
7388
[migrated]: /interop/js-interop/package-web/

0 commit comments

Comments
 (0)