Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add entrypoint URI to wasm URI too.
  • Loading branch information
natebiggs committed May 27, 2025
commit eb217df58e4951c29e11e938d07f1ac3e34c9772
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export class FlutterEntrypointLoader {
const compiledDartApp = await compiledDartAppPromise;
const dartApp = await compiledDartApp.instantiate(await importsPromise, {
loadDynamicModule: async (wasmUri, mjsUri) => {
const wasmBytes = fetch(resolveUrlWithSegments(wasmUri));
const wasmBytes = fetch(resolveUrlWithSegments(entrypointBaseUrl, wasmUri));
let mjsRuntimeUri = resolveUrlWithSegments(entrypointBaseUrl, mjsUri);
Comment on lines +178 to +180
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some documentation about this that I can look at? I'm trying to understand why mjsUri is prefixed by entrypointBaseUrl but not wasmUri.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call out, thanks! During local testing this worked without that but the paths are probably simpler in that environment.

I went ahead and added the entrypointBaseUrl since the URL generated should have the same format as that of the main module which also uses entrypointBaseUrl.

Documentation on this input here: https://github.com/dart-lang/sdk/blob/main/pkg/dart2wasm/lib/js/runtime_blob.dart#L54

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay, that makes more sense :)

Thanks for the link!

if (this._ttPolicy != null) {
mjsRuntimeUri = this._ttPolicy.createScriptURL(mjsRuntimeUri);
Expand Down