momo file loader for webpack
Checkout momo-language here. The fastest way to get up and running with WebAssembly.
This loader converts .momo
files to wasm
bytecode.
Install
npm install --save-dev momo-loader wasm-loader
Usage
Edit webpack.config.js:
resolve: extensions: '.js' '.momo'...loaders: test: /\.wasm$/ loaders: 'wasm-loader' 'momo-loader'
You can refer to example.webpack.config.js
in this repo for an example.
Example
Here we are going to use main.momo example, and save it to /momo/main.momo
:
int; extern int;
Later simply include the file in your JavaScript and instantiate the module:
; const mainInstance = ;console // 33
That's it.