0.1.3 • Published 5 years ago

wasm-interface-types-loader v0.1.3

Weekly downloads
1
License
MIT/Apache-2.0
Repository
github
Last release
5 years ago

wasm-interface-types-loader NPM module

This directory contains a Webpack loader called wasm-interface-types-loader used for loading a *.wasm file directly with Webpack where the *.wasm file has a custom section for WebAssembly Interface Types.

Example usage

First, you'll need to install this package with:

$ npm intsall wasm-interface-types-loader

Next you'll want to add this to your webpack.config.js:

module.exports = {
  // ...
  module: {
    rules: [
      {
        test: /^(?:(?!_bg).)*\.wasm$/i,
        type: "javascript/auto",
        use: "wasm-interface-types-loader",
      },
    ],
  },
  // ...
};

And then in your code you can use:

import { myFunction } from "./my-wasm-file.wasm";

Or if you're in the "main chunk" you'll have to use a dynamic import:

async function run() {
  const { myFunction } = await import("./my-wasm-file.wasm");
}

run();

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago