This is a sample project for generating npm packages with mruby/edge + wasm-pack.
It includes an example of using the generated npm package from Vite under the examples/ directory.
Simply run wasm-pack to generate the npm package under the pkg directory.
$ wasm-pack build --target webTo run the Vite example, go to the examples/mrubyedge-example directory and install dependencies with npm or yarn, then run the development server.
$ cd examples/mrubyedge-example
$ npm install
$ npm run dev- is located in
src/mruby/directory. build.rscompiles the Ruby script into mrb files during the build process.build.rsautomatically generates the mrb files to include, so no additional tools need to be installed (such asmrbc).- To change the functions you want to export, modify the functions with the
#[wasm_bindgen]annotation insrc/lib.rs.
Licensed under MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
Welcome pull requests!