Same way you would C code. Tell the compiler you want to compile for debugging, and then connect your debugger to the running program. Marks in the code will tell your debugger what things are called and which line in the source code you are on.
JS today is often transpiled anyway, so you have to use some mapping to the source code to do debugging (eg. source maps).
The debuggers would need to be modified to support it, but I don't think there's a reason that you couldn't debug wasm inside a browser, if they were built to understand the debug annotations in the wasm code.
JS today is often transpiled anyway, so you have to use some mapping to the source code to do debugging (eg. source maps).