Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 671c277

Browse files
authored
Compile dart2wasm modules using the JS runtime exported compileStreaming (#51488)
With [1] dart2wasm started using the new Wasm built-in string import `wasm:js-string`. With [2] dart2wasm started exporting `compile` and `compileStreaming` from the generated JS runtime to compile dart2wasm-generated modules with the `wasm:js-string` built-in, polyfilling it when not available. Update Wasm compilation code in Flutter to use `compileStreaming` from the JS runtime, enabling fast `jwasm:js-string` module when available. [1]: dart-lang/sdk@44c2e17 [2]: dart-lang/sdk@4cd6096
1 parent a324631 commit 671c277

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/web_ui/flutter_js/src/entrypoint_loader.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ export class FlutterEntrypointLoader {
152152
let jsSupportRuntimeUri = resolveUrlWithSegments(entrypointBaseUrl, jsSupportRuntimePath);
153153
if (this._ttPolicy != null) {
154154
jsSupportRuntimeUri = this._ttPolicy.createScriptURL(jsSupportRuntimeUri);
155-
}
156-
const dartModulePromise = WebAssembly.compileStreaming(fetch(moduleUri));
157-
155+
}
158156
const jsSupportRuntime = await import(jsSupportRuntimeUri);
159157

158+
const dartModulePromise = jsSupportRuntime.compileStreaming(fetch(moduleUri));
159+
160160
let imports;
161161
if (build.renderer === "skwasm") {
162162
imports = (async () => {

0 commit comments

Comments
 (0)