Hey. I started a plugin, wasmify, for importing WebAssembly code. I wanted to share my progress. 😄
Firstly, you can run this with or without a config. Without simply lets you import .wasm files. While configs are responsible for compiling source files (C, C++, etc.) into webassembly and loading it at runtime.
browserify -p wasmify
# With config
browserify -p [ wasmify -c emscripten ]
Here is an example with no config.
const createSample = require('./sample.wasm')
// Initialize module
const sample = createSample({ ...imports })
// Run WebAssembly function
sample.main()
And here is an example using an Emscripten config:
const sample = require('./sample.c')
// Call C function
sample._main()
I hope to add better C/C++ support in the future, as well as configs for other languages. Currently emscripten (for C/C++) and wabt (for WAT) are supported.
Hey. I started a plugin,
wasmify, for importing WebAssembly code. I wanted to share my progress. 😄Firstly, you can run this with or without a config. Without simply lets you import
.wasmfiles. While configs are responsible for compiling source files (C, C++, etc.) into webassembly and loading it at runtime.Here is an example with no config.
And here is an example using an Emscripten config:
I hope to add better C/C++ support in the future, as well as configs for other languages. Currently
emscripten(for C/C++) andwabt(for WAT) are supported.