File tree 5 files changed +15
-10
lines changed
5 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -976,8 +976,9 @@ export class JSBuilder extends ExportsWalker {
976
976
}
977
977
sb . push ( `} = await (async url => instantiate(
978
978
await (async () => {
979
- try { return await globalThis.WebAssembly.compileStreaming(globalThis.fetch(url)); }
980
- catch { return globalThis.WebAssembly.compile(await (await import("node:fs/promises")).readFile(url)); }
979
+ const isNodeOrBun = typeof process != "undefined" && process.versions != null && (process.versions.node != null || process.versions.bun != null);
980
+ if (isNodeOrBun) { return globalThis.WebAssembly.compile(await (await import("node:fs/promises")).readFile(url)); }
981
+ else { return await globalThis.WebAssembly.compileStreaming(globalThis.fetch(url)); }
981
982
})(), {
982
983
` ) ;
983
984
let needsMaybeDefault = false ;
Original file line number Diff line number Diff line change @@ -553,8 +553,9 @@ export const {
553
553
fn,
554
554
} = await ( async url => instantiate (
555
555
await ( async ( ) => {
556
- try { return await globalThis . WebAssembly . compileStreaming ( globalThis . fetch ( url ) ) ; }
557
- catch { return globalThis . WebAssembly . compile ( await ( await import ( "node:fs/promises" ) ) . readFile ( url ) ) ; }
556
+ const isNodeOrBun = typeof process != "undefined" && process . versions != null && ( process . versions . node != null || process . versions . bun != null ) ;
557
+ if ( isNodeOrBun ) { return globalThis . WebAssembly . compile ( await ( await import ( "node:fs/promises" ) ) . readFile ( url ) ) ; }
558
+ else { return await globalThis . WebAssembly . compileStreaming ( globalThis . fetch ( url ) ) ; }
558
559
} ) ( ) , {
559
560
}
560
561
) ) ( new URL ( "esm.debug.wasm" , import . meta. url ) ) ;
Original file line number Diff line number Diff line change @@ -553,8 +553,9 @@ export const {
553
553
fn,
554
554
} = await ( async url => instantiate (
555
555
await ( async ( ) => {
556
- try { return await globalThis . WebAssembly . compileStreaming ( globalThis . fetch ( url ) ) ; }
557
- catch { return globalThis . WebAssembly . compile ( await ( await import ( "node:fs/promises" ) ) . readFile ( url ) ) ; }
556
+ const isNodeOrBun = typeof process != "undefined" && process . versions != null && ( process . versions . node != null || process . versions . bun != null ) ;
557
+ if ( isNodeOrBun ) { return globalThis . WebAssembly . compile ( await ( await import ( "node:fs/promises" ) ) . readFile ( url ) ) ; }
558
+ else { return await globalThis . WebAssembly . compileStreaming ( globalThis . fetch ( url ) ) ; }
558
559
} ) ( ) , {
559
560
}
560
561
) ) ( new URL ( "esm.release.wasm" , import . meta. url ) ) ;
Original file line number Diff line number Diff line change @@ -162,8 +162,9 @@ export const {
162
162
takesFunction,
163
163
} = await ( async url => instantiate (
164
164
await ( async ( ) => {
165
- try { return await globalThis . WebAssembly . compileStreaming ( globalThis . fetch ( url ) ) ; }
166
- catch { return globalThis . WebAssembly . compile ( await ( await import ( "node:fs/promises" ) ) . readFile ( url ) ) ; }
165
+ const isNodeOrBun = typeof process != "undefined" && process . versions != null && ( process . versions . node != null || process . versions . bun != null ) ;
166
+ if ( isNodeOrBun ) { return globalThis . WebAssembly . compile ( await ( await import ( "node:fs/promises" ) ) . readFile ( url ) ) ; }
167
+ else { return await globalThis . WebAssembly . compileStreaming ( globalThis . fetch ( url ) ) ; }
167
168
} ) ( ) , {
168
169
}
169
170
) ) ( new URL ( "noExportRuntime.debug.wasm" , import . meta. url ) ) ;
Original file line number Diff line number Diff line change @@ -162,8 +162,9 @@ export const {
162
162
takesFunction,
163
163
} = await ( async url => instantiate (
164
164
await ( async ( ) => {
165
- try { return await globalThis . WebAssembly . compileStreaming ( globalThis . fetch ( url ) ) ; }
166
- catch { return globalThis . WebAssembly . compile ( await ( await import ( "node:fs/promises" ) ) . readFile ( url ) ) ; }
165
+ const isNodeOrBun = typeof process != "undefined" && process . versions != null && ( process . versions . node != null || process . versions . bun != null ) ;
166
+ if ( isNodeOrBun ) { return globalThis . WebAssembly . compile ( await ( await import ( "node:fs/promises" ) ) . readFile ( url ) ) ; }
167
+ else { return await globalThis . WebAssembly . compileStreaming ( globalThis . fetch ( url ) ) ; }
167
168
} ) ( ) , {
168
169
}
169
170
) ) ( new URL ( "noExportRuntime.release.wasm" , import . meta. url ) ) ;
You can’t perform that action at this time.
0 commit comments