如何从 WebAssembly 文件中删除调试符号

How to remove debug symbols from a WebAssembly file

我正在查看浏览器控制台,而 运行 是一个 wasm 程序。发出的警告表明该程序对源非常了解。我想删除所有这些并有一个小而简洁的二进制文件。

那么给定一个文件 file.wasm,我如何轻松去除所有这些调试符号?

非常感谢

来自the documentation

Emcc strips out most of the debug information from optimized builds by default. Optimisation levels -O1 and above remove LLVM debug information, and also disable runtime ASSERTIONS checks. From optimization level -O2 the code is minified by the Closure Compiler and becomes virtually unreadable.