Skip to content

Commit 06c08d4

Browse files
committed
Index.html in the pathname should be optional
When fixing paths in the url for Dart-flute-wasm I neglected to handle the case where index.html is not in the URL. It should now be robust against any rename of index.html too.
1 parent c4e2cf1 commit 06c08d4

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)