New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebAssembly #1636
Comments
Thanks, this is awesome! Have added it to the list of plugins. I'll close this issue as there isn't any action required for Rollup, but I'm excited to see where this goes. |
Hi, I was trying to build a JavaScript SDK over my C library. I converted my C library to WASM using EMScripten, which also provided me a wrapper JS code to call the C functions in JavaScript. I wrote my JavaScript SDK by making multiple calls to WASM and everything seemed to work. Now when I tried to build a bundle for production, I am encountering read errors. Can someone help me with my situation? Any suggestions would be appreciated. Thank You |
@skandonkumar WebAssembly support in Rollup is not perfect, the only option right now is |
Hey! I recently made
rollup-plugin-wasm
to try and support WebAssembly in Rollup. I wanted to share the results so far.Firstly, the base plugin (
wasm()
) allows you to import plain.wasm
files:This is fine if the compiler supports standalone binaries which you can import easily.
But, this plugin also allows you to require source files which have more complex conditions by using:
compile
method which turns source code into WebAssembly.load
method for preparing WebAssembly exports (setting memory, tables, etc.)By default, there is two configs implementing these that you can use:
wasm.emscripten
for using C/C++ with Emscriptenwasm.wabt
for using WAT with WebAssembly Binary ToolkitHere is an example of
rollup.config.js
using Emscripten for C/C++ imports:And an example of how you would write code:
A good start! But it is still limited in terms of the libraries you can use, because the loader is simple.
Ideas for the future include:
The text was updated successfully, but these errors were encountered: