Skip to content

Commit e4f6b7d

Browse files
authored
Merge pull request #3 from nikgraf/fix-loader
comply to new validation requirements of node 10 for custom loaders
2 parents 5a13df4 + a7c28f1 commit e4f6b7d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

loader.mjs

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function readFile(path) {
2424
}
2525

2626
export async function dynamicInstantiate(url) {
27-
const buffer = readFile(url);
27+
const buffer = readFile((new URL(url)).pathname);
2828
const module = new WebAssembly.Module(buffer);
2929

3030
const wasmExports = [];
@@ -86,7 +86,7 @@ export function resolve(specifier, base, defaultResolver) {
8686

8787
if (ext === ".wasm") {
8888
return {
89-
url: specifier,
89+
url: path.join(path.dirname(base), specifier),
9090
format: 'dynamic'
9191
};
9292
}

0 commit comments

Comments
 (0)