All Projects → wasm-tool → Wasm Pack Plugin

wasm-tool / Wasm Pack Plugin

Licence: mit
webpack plugin for Rust

Programming Languages

javascript
184084 projects - #8 most used programming language
rust
11053 projects

Labels

Projects that are alternatives of or similar to Wasm Pack Plugin

Squark
Rust frontend framework, for web browser and more.
Stars: ✭ 162 (-11.96%)
Mutual labels:  wasm
Edit Text
Collaborative rich text editor for the web. Written in Rust + WebAssembly.
Stars: ✭ 171 (-7.07%)
Mutual labels:  wasm
Lam
🚀 a lightweight, universal actor-model vm for writing scalable and reliable applications that run natively and on WebAssembly
Stars: ✭ 176 (-4.35%)
Mutual labels:  wasm
Gweb
Interact with browser from Go. Manually-crafted WebAPI interoperation library.
Stars: ✭ 163 (-11.41%)
Mutual labels:  wasm
Wasm Micro Runtime
WebAssembly Micro Runtime (WAMR)
Stars: ✭ 2,440 (+1226.09%)
Mutual labels:  wasm
Alchemyvm
WebAssembly Virtual Machine Built In Elixir
Stars: ✭ 176 (-4.35%)
Mutual labels:  wasm
Console error panic hook
A panic hook for wasm32-unknown-unknown that logs panics with console.error
Stars: ✭ 159 (-13.59%)
Mutual labels:  wasm
Raw Wasm
Raw WebAssembly demos
Stars: ✭ 183 (-0.54%)
Mutual labels:  wasm
Carton
📦 Watcher, bundler, and test runner for your SwiftWasm apps
Stars: ✭ 171 (-7.07%)
Mutual labels:  wasm
Wag
WebAssembly compiler implemented in Go
Stars: ✭ 177 (-3.8%)
Mutual labels:  wasm
Compile To Web
Discover what languages can be compiled to Web Assembly
Stars: ✭ 164 (-10.87%)
Mutual labels:  wasm
Localpdfmerger
Merge PDFs locally in the Browser using Webassembly
Stars: ✭ 163 (-11.41%)
Mutual labels:  wasm
Tdl
Node.js bindings to TDLib.
Stars: ✭ 177 (-3.8%)
Mutual labels:  wasm
Wasm Pdf
Generate PDF files with JavaScript and WASM (WebAssembly)
Stars: ✭ 163 (-11.41%)
Mutual labels:  wasm
Webgui
An example demo of IMGUI (Immediate Mode GUI) on the web. Using only WebGL, GLFW and ImGui. Suitable for being compiled to web assembly (WASM).
Stars: ✭ 180 (-2.17%)
Mutual labels:  wasm
Wain
WebAssembly implementation from scratch in Safe Rust with zero dependencies
Stars: ✭ 160 (-13.04%)
Mutual labels:  wasm
Serde Wasm Bindgen
Native integration of Serde with wasm-bindgen
Stars: ✭ 176 (-4.35%)
Mutual labels:  wasm
Prototype
(deprecated) The journey continues at ASNEXT: https://github.com/AssemblyScript/assemblyscript
Stars: ✭ 2,114 (+1048.91%)
Mutual labels:  wasm
Quasar
An experimental rust-to-{wasm,asmjs} frontend framework.
Stars: ✭ 180 (-2.17%)
Mutual labels:  wasm
Webassembly Examples
From Simple To Complex. A complete collection of webassembly examples.
Stars: ✭ 177 (-3.8%)
Mutual labels:  wasm

@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.

The minimum required wasm-pack version is 0.8.0

Usage

Add the loader in your webpack.config.js:

const path = require("path");
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");

module.exports = {
  // ...

  plugins: [

    new WasmPackPlugin({
      crateDirectory: path.resolve(__dirname, "crate"),

      // Check https://rustwasm.github.io/wasm-pack/book/commands/build.html for
      // the available set of arguments.
      //
      // Optional space delimited arguments to appear before the wasm-pack
      // command. Default arguments are `--verbose`.
      args: "--log-level warn",
      // Default arguments are `--typescript --target browser --mode normal`.
      extraArgs: "--no-typescript",

      // Optional array of absolute paths to directories, changes to which
      // will trigger the build.
      // watchDirectories: [
      //   path.resolve(__dirname, "another-crate/src")
      // ],

      // The same as the `--out-dir` option for `wasm-pack`
      // outDir: "pkg",

      // The same as the `--out-name` option for `wasm-pack`
      // outName: "index",

      // If defined, `forceWatch` will force activate/deactivate watch mode for
      // `.rs` files.
      //
      // The default (not set) aligns watch mode for `.rs` files to Webpack's
      // watch mode.
      // forceWatch: true,

      // If defined, `forceMode` will force the compilation mode for `wasm-pack`
      //
      // Possible values are `development` and `production`.
      //
      // the mode `development` makes `wasm-pack` build in `debug` mode.
      // the mode `production` makes `wasm-pack` build in `release` mode.
      // forceMode: "development",
 
      // Controls plugin output verbosity, either 'info' or 'error'.
      // Defaults to 'info'.
      // pluginLogLevel: 'info'
    }),

  ]

  // ...
};

and then import your pkg folder from wasm-pack:

import("./path/to/your/pkg").then(module => {
  module.run();
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].