Skip to content

Commit 901c95b

Browse files
authored
Merge pull request #57 from kmiller68/module-url-fix-v2
Index.html in the pathname should be optional
2 parents c4e2cf1 + 06c08d4 commit 901c95b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Dart/benchmark.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ 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-
let pathname = location.pathname.match(/(.*)index\.html/)[1];
272+
const pathname = location.pathname.match(/^(.*\/)(?:[^.]+(?:\.(?:[^\/]+))+)?$/)[1];
273273
this.dart2wasmJsModule = await import(location.origin + pathname + "./Dart/build/flute.dart2wasm.mjs");
274274
} else {
275275
// In shells, relative imports require different paths, so try with and

0 commit comments

Comments
 (0)