0.1.0 • Published 4 years ago

image-bunker v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

ImageBunker

squoosh的几个wasm编码模块拎出来做一个独立的包

import getCodec from "image-bunker";
const imagequant = await getCodec("imagequant");
const oxipng = await getCodec("oxipng");
const boweserpng = await getCodec("browserpng");
const mozjpeg = await getCodec("mozjpeg");

webpack.config

[
  ...
  {
    test: /\.wasm$/,
    exclude: /_bg\.wasm$/,
    type: "javascript/auto",
    loader: "file-loader",
    options: {
      name: "[name].[hash:5].[ext]",
    }
  },
  {
    test: /_bg\.wasm$/,
    type: "webassembly/experimental",
  });
]