WASM-MERGE(1)

πŸ“¦
version 131 Β· 3 versions
, in ubuntu stonking

πŸ’– NAME πŸ’–

okay bestie, welcome to wasm-merge πŸ’… β€” it's a User Commands manual page (section 1, obvs), and it does exactly one iconic thing: merges wasm files into one. that's the whole gig. slay.


πŸ¦‹ DESCRIPTION πŸ¦‹

================================================================================
wasm-merge INFILE1 NAME1 INFILE2 NAME2 [..]

so like. merge wasm files into one. that's it, that's the vibe ✨

for example, bestie:

wasm-merge foo.wasm foo bar.wasm bar -o merged.wasm

this will read foo.wasm and bar.wasm, with names foo and bar respectively 🫢 so if the second one imports from foo, we will see that as an import from the first module after the merge. and the merged output? written to merged.wasm. iconic.

not me β€” note that filenames and modules names are interleaved (which is hopefully less confusing) 😭 so yeah, keep your eyes on the pattern: file, name, file, name.

input source maps can be specified by adding an -ism option right after the module name:

wasm-merge foo.wasm foo -ism foo.wasm.map ...
================================================================================

✨ wasm-merge options ✨

  • --output, -o β€” the output file πŸ’Ύ
  • --input-source-map, -ism β€” consume source maps from the specified files πŸ—ΊοΈ
  • --output-source-map, -osm β€” emit source map to the specified file
  • --output-source-map-url, -osu β€” emit specified string as source map URL πŸ”—
  • --output-manifest β€” write a wasm-split manifest to the specified file. this manifest can be given to wasm-split to split the merged module along the lines of the original modules. implies --debuginfo to preserve function names in the output module 🧾
  • --rename-export-conflicts, -rec β€” rename exports to avoid conflicts (rather than error) 🏷️
  • --skip-export-conflicts, -sec β€” skip exports that conflict with previous ones πŸ™ˆ
  • --emit-text, -S β€” emit text instead of binary for the output file πŸ“
  • --debuginfo, -g β€” emit names section and debug info πŸ›

πŸ”§ Tool options πŸ”§

  • --mvp-features, -mvp β€” disable all non-MVP features 🚫
  • --all-features, -all β€” enable all features 🌈
  • --detect-features β€” (deprecated - this flag does nothing) πŸ’€
  • --quiet, -q β€” emit less verbose output and hide trivial warnings. 🀫
  • --experimental-poppy β€” parse wast files as Poppy IR for testing purposes. 🌸
  • --emit-module-names β€” emit module names, even if not emitting the rest of the names section. 🏷️
  • --enable-sign-ext β€” enable sign extension operations
  • --disable-sign-ext β€” disable sign extension operations
  • --enable-threads β€” enable atomic operations βš›οΈ
  • --disable-threads β€” disable atomic operations
  • --enable-mutable-globals β€” enable mutable globals
  • --disable-mutable-globals β€” disable mutable globals
  • --enable-nontrapping-float-to-int β€” enable nontrapping float-to-int operations
  • --disable-nontrapping-float-to-int β€” disable nontrapping float-to-int operations
  • --enable-simd β€” enable SIMD operations and types
  • --disable-simd β€” disable SIMD operations and types
  • --enable-bulk-memory β€” enable bulk memory operations
  • --disable-bulk-memory β€” disable bulk memory operations
  • --enable-bulk-memory-opt β€” enable memory.copy and memory.fill
  • --disable-bulk-memory-opt β€” disable memory.copy and memory.fill
  • --enable-call-indirect-overlong β€” enable LEB encoding of call-indirect (Ignored for compatibility as it has no effect on Binaryen)
  • --disable-call-indirect-overlong β€” disable LEB encoding of call-indirect (Ignored for compatibility as it has no effect on Binaryen)
  • --enable-exception-handling β€” enable exception handling operations 🚨
  • --disable-exception-handling β€” disable exception handling operations
  • --enable-tail-call β€” enable tail call operations
  • --disable-tail-call β€” disable tail call operations
  • --enable-reference-types β€” enable reference types
  • --disable-reference-types β€” disable reference types
  • --enable-multivalue β€” enable multivalue functions
  • --disable-multivalue β€” disable multivalue functions
  • --enable-gc β€” enable garbage collection πŸ—‘οΈ
  • --disable-gc β€” disable garbage collection
  • --enable-memory64 β€” enable memory64
  • --disable-memory64 β€” disable memory64
  • --enable-relaxed-simd β€” enable relaxed SIMD 😌
  • --disable-relaxed-simd β€” disable relaxed SIMD
  • --enable-extended-const β€” enable extended const expressions
  • --disable-extended-const β€” disable extended const expressions
  • --enable-strings β€” enable strings 🧡
  • --disable-strings β€” disable strings
  • --enable-multimemory β€” enable multimemory
  • --disable-multimemory β€” disable multimemory
  • --enable-stack-switching β€” enable stack switching πŸ₯ž
  • --disable-stack-switching β€” disable stack switching
  • --enable-shared-everything β€” enable shared-everything threads
  • --disable-shared-everything β€” disable shared-everything threads
  • --enable-fp16 β€” enable float 16 operations
  • --disable-fp16 β€” disable float 16 operations
  • --enable-custom-descriptors β€” enable custom descriptors (RTTs) and exact references
  • --disable-custom-descriptors β€” disable custom descriptors (RTTs) and exact references
  • --enable-multibyte β€” enable multibyte array loads and stores
  • --disable-multibyte β€” disable multibyte array loads and stores
  • --enable-relaxed-atomics β€” enable acquire/release atomic memory operations
  • --disable-relaxed-atomics β€” disable acquire/release atomic memory operations
  • --enable-custom-page-sizes β€” enable custom page sizes πŸ“„
  • --disable-custom-page-sizes β€” disable custom page sizes
  • --enable-wide-arithmetic β€” enable wide arithmetic
  • --disable-wide-arithmetic β€” disable wide arithmetic
  • --enable-compact-imports β€” enable compact import section
  • --disable-compact-imports β€” disable compact import section
  • --enable-typed-function-references β€” Deprecated compatibility flag ⚠️
  • --disable-typed-function-references β€” Deprecated compatibility flag ⚠️
  • --no-validation, -n β€” disables validation, assumes inputs are correct 😳 (yes it just trusts you. bold of it. but ok.)
  • --pass-arg, -pa β€” an argument passed along to optimization passes being run. must be in the form KEY@VALUE. if KEY is the name of a pass then it applies to the closest instance of that pass before us. if KEY is not the name of a pass then it is a global option that applies to all pass instances that read it. πŸ”‘
  • --closed-world, -cw β€” assume code outside of the module does not inspect or interact with GC and function references, even if they are passed out. the outside may hold on to them and pass them back in, but not inspect their contents or call them. πŸšͺ
  • --preserve-type-order β€” preserve the order of types from the input (useful for debugging and testing) πŸ”’
  • --generate-stack-ir β€” generate StackIR during writing
  • --optimize-stack-ir β€” optimize StackIR during writing
  • --print-stack-ir β€” print StackIR during writing

🌟 General options 🌟

  • --version β€” output version information and exit 🏷️
  • --help, -h β€” show this help message and exit πŸ†˜
  • --debug, -d β€” print debug information to stderr 🐞

and that's the whole page, bestie, you ate it πŸ’…βœ¨πŸ¦‹

this was wasm-merge version 131, from August 2026 β€” ty for coming to my ted talk, mwah πŸ«ΆπŸ’–

πŸ“¦ where this page comes from