archiver-webpack-plugin

Generate a compressed archive of compiled assets.

Usage no npm install needed!

<script type="module">
  import archiverWebpackPlugin from 'https://cdn.skypack.dev/archiver-webpack-plugin';
</script>

README

npm node dependencies test semantic-release

Archiver Plugin

Generate a compressed archive of compiled assets.

Table of Contents

Installation

npm install archiver archiver-webpack-plugin --save-dev

Usage

Using the built-in Archiver instance

const ArchiverPlugin = require("archiver-webpack-plugin");

module.exports = {
  plugins: [
    new ArchiverPlugin({
      format: "zip",
      formatOptions: {
        zlib: {
          level: 9,
        },
      },
    }),
  ],
};

Using a custom Archiver instance

const ArchiverPlugin = require("archiver-webpack-plugin");
const archiver = require("archiver");

const archive = archiver("zip", {
  zlib: {
    level: 9,
  },
});

module.exports = {
  plugins: [
    new ArchiverPlugin({
      archive,
    }),
  ],
};

Arguments:

  • output: The archive output path.
  • test: All assets matching this RegExp are processed. Defaults to every asset.
  • format: The archive format. Defaults to "zip".
  • formatOptions: The archive format options. Defaults to "{}".
  • archive: An Archiver instance. Defaults to the built-in instance.

API

See the detailed API Reference.

Author

Alexandre Breteau - @0xSeldszar

License

MIT © Alexandre Breteau