Skip to content

WebAssembly #8

@jamen

Description

@jamen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions