Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/preamble.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,13 @@ function instrumentWasmTableWithAbort() {
}
#endif

#if SINGLE_FILE
// In SINGLE_FILE mode the wasm binary is encoded inline here as a data: URL.
var wasmBinaryFile = '{{{ WASM_BINARY_FILE }}}';
#else
var wasmBinaryFile;
function findWasmBinary() {
#if EXPORT_ES6 && USE_ES6_IMPORT_META && !SINGLE_FILE && !AUDIO_WORKLET
#if EXPORT_ES6 && USE_ES6_IMPORT_META && !AUDIO_WORKLET
if (Module['locateFile']) {
#endif
var f = '{{{ WASM_BINARY_FILE }}}';
Expand All @@ -614,7 +619,7 @@ function findWasmBinary() {
}
#endif
return f;
#if EXPORT_ES6 && USE_ES6_IMPORT_META && !SINGLE_FILE && !AUDIO_WORKLET // In single-file mode, repeating WASM_BINARY_FILE would emit the contents again. For an Audio Worklet, we cannot use `new URL()`.
#if EXPORT_ES6 && USE_ES6_IMPORT_META && !AUDIO_WORKLET // In single-file mode, repeating WASM_BINARY_FILE would emit the contents again. For an Audio Worklet, we cannot use `new URL()`.
}
#if ENVIRONMENT_MAY_BE_SHELL
if (ENVIRONMENT_IS_SHELL)
Expand All @@ -624,8 +629,7 @@ function findWasmBinary() {
return new URL('{{{ WASM_BINARY_FILE }}}', import.meta.url).href;
#endif
}

var wasmBinaryFile;
#endif

function getBinarySync(file) {
if (file == wasmBinaryFile && wasmBinary) {
Expand Down Expand Up @@ -1079,7 +1083,9 @@ function getWasmImports() {
}
#endif

#if !SINGLE_FILE
wasmBinaryFile ??= findWasmBinary();
#endif

#if WASM_ASYNC_COMPILATION
#if RUNTIME_DEBUG
Expand Down
2 changes: 1 addition & 1 deletion test/other/test_unoptimized_code_size.js.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
53981
53980
2 changes: 1 addition & 1 deletion test/other/test_unoptimized_code_size_no_asserts.js.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
29401
29400
2 changes: 1 addition & 1 deletion test/other/test_unoptimized_code_size_strict.js.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
52777
52776
Loading