Closed ballercat closed 6 years ago
Thanks @ballercat - nice job :-)
@ColinEberhardt Should this be released as a patch? I assume by squashing the commits into a fix: ... one?
Yes, that does the trick. I've squashed and merged here https://github.com/rollup/rollup-plugin-wasm/commit/d20a50724ec5b9e89a9753e68535572f3c052956
Hi there,
First of, thanks for the great work on the plugin! I have recently attempted to bundle some pre-build wasm binaries into a project with rollup and noticed that a wasm binary which is sufficiently large/complex would not be accurately compiled by this plugin. It seems like different section encodings are mangled ( but it's tough to say from the WebAssembly errors ).
It appears to be due to the fact that rollup loads sources as
utf-8
strings, this encoding may mangle binary information in some cases and is backed up by this issue https://github.com/rollup/rollup/issues/1786 Unfortunately, as long as this is an issue, this plugin is not very useful for anything beyond a few lines of simple WebAssembly, so I took the liberty of patching in a loader function for this plugin as well as some tests to go along with it.The added tests to demonstrate the problem, and this behavior can be replicated with the loader hook removed. I added a custom pre-build binary which I verified with https://github.com/WebAssembly/wabt toolkits and converted back to a valid wast file in the PR.
Please consider merging this change, Thanks