Skip to content

Commit

Permalink
fix: __filename runtime error
Browse files Browse the repository at this point in the history
Signed-off-by: Gordon Smith <[email protected]>
  • Loading branch information
GordonSmith committed Sep 24, 2022
1 parent 7265d41 commit 969f62d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function trimStart(str: string, charToRemove: string) {
return str;
}

let scriptDir = (globalThis?.document?.currentScript as HTMLScriptElement)?.src ?? __filename ?? "./dummy.js";
let scriptDir = (globalThis?.document?.currentScript as HTMLScriptElement)?.src ?? globalThis?.__filename ?? "./dummy.js";
scriptDir = scriptDir.substring(0, scriptDir.replace(/[?#].*/, "").lastIndexOf('/') + 1);

async function browserFetch(wasmUrl: string): Promise<ArrayBuffer> {
Expand Down

0 comments on commit 969f62d

Please sign in to comment.