Skip to content

Commit b2c9274

Browse files
committed
Add the pathname when resolving flute.dart2wasm.mjs
If the server puts index.html in a subdirectory the current code will fail to resolve so we need to add the pathname.
1 parent 8f56a4e commit b2c9274

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Dart/benchmark.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ class Benchmark {
269269
if (isInBrowser) {
270270
// In browsers, relative imports don't work since we are not in a module.
271271
// (`import.meta.url` is not defined.)
272-
this.dart2wasmJsModule = await import(location.origin + "/Dart/build/flute.dart2wasm.mjs");
272+
let pathname = location.pathname.match(/(.*)index\.html/)[1];
273+
this.dart2wasmJsModule = await import(location.origin + pathname + "./Dart/build/flute.dart2wasm.mjs");
273274
} else {
274275
// In shells, relative imports require different paths, so try with and
275276
// without the "./" prefix (e.g., JSC requires it).

0 commit comments

Comments
 (0)