CrownBonded / binaryen-webpack-plugin

Binaryen plugin for webpack: shrinks wasm files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Binaryen Webpack Plugin

A plugin for webpack that runs Binaryen on WebAssembly assets, shrinking and optimizing them. You can think of Binaryen as a minifier for WebAssembly the same way that there are minifiers for JavaScript.

Install

npm i -D binaryen-webpack-plugin

Usage

var BinaryenPlugin = require("binaryen-webpack-plugin");
module.exports = {
  plugins: [
    new BinaryenPlugin({})
  ]
}

TODO

  • Arguments (pick the optimization level, passes to run, files to filter, etc.) and docs for them.
  • Code cleanup (I'm new to npm and webpack).
  • This currently runs the Binaryen optimizer on each wasm asset. We can do even better by running Binaryen metadce on the entire graph, so that if JS (and other wasm modules) don't use something a wasm file then we can remove it. This would need deeper integration with webpack.

About

Binaryen plugin for webpack: shrinks wasm files

License:Apache License 2.0


Languages

Language:Python 52.5%Language:JavaScript 47.5%