Skip to content

3846masa-tmp/wasm-pack-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@wasm-tool/wasm-pack-plugin

Webpack plugin for Rust

Installation

yarn add --dev @wasm-tool/wasm-pack-plugin

wasm-pack

We expect wasm-pack to be in your $PATH. See installation here.

Usage

Add the loader in your webpack.config.js:

module.exports = {
  // ...

  plugins: [

    new WasmPackPlugin({
      crateDirectory: path.resolve(__dirname, "crate"),
      // check https://rustwasm.github.io/wasm-pack/book/commands/build.html for extraArgs
      // defautls --typescript --target browser --mode normal
      extraArgs: "--no-typescript --mode no-install",
    }),

  ]

  // ...
};

and then import your pkg folder from wasm-pack:

import("./path/to/your/pkg").then(module => {
  module.run();
});

About

Webpack plugin for Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 73.1%
  • Rust 26.9%