@tanem/archiver-webpack-plugin
    TypeScript icon, indicating that this package has built-in type declarations

    6.1.2 • Public • Published

    archiver-webpack-plugin

    npm version build status coverage status npm downloads

    A webpack plugin that uses node-archiver to generate .zip, .tar, .tar.gz, or jar archives when the build is done.

    Basic Usage

    const { ArchiverWebpackPlugin } = require('@tanem/archiver-webpack-plugin')
    const path = require('path')
    
    module.exports = {
      mode: 'development',
      entry: './foo.js',
      output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'foo.bundle.js',
      },
      plugins: [new ArchiverWebpackPlugin('zip')],
    }

    API

    Arguments

    • format - The archive format. One of zip, tar or jar.
    • options - Optional An object containing the optional arguments defined below. Defaults to {}.
      • destpath - Optional The destination path within the archive. Defaults to '', which means files are output to the root of the archive.
      • filename - Optional The name of the archive. '.zip', '.tar', '.tar.gz' or '.jar' will be appended where appropriate. Defaults to the basename of the webpack output path.
      • formatOptions - Optional Allows fine-tuning of archiving. Defaults to the archiver defaults.
      • globOptions - Optional The glob options that will change pattern matching behaviour. Defaults to the node-glob defaults, but sets cwd to the output path. Any globOptions passed will take precedence.
      • globPattern - Optional The glob pattern that determines what will be included in the archive. Defaults to '**/*' which will include all files in the output path.

    Example

    const { ArchiverWebpackPlugin } = require('@tanem/archiver-webpack-plugin')
    const path = require('path')
    
    module.exports = {
      mode: 'development',
      entry: './foo.js',
      output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'foo.bundle.js',
      },
      plugins: [
        new ArchiverWebpackPlugin('tar', {
          destpath: 'foo',
          filename: 'bar-baz',
          formatOptions: { gzip: true },
          globOptions: { dot: true, ignore: '*.map' },
          globPattern: '*',
        }),
      ],
    }

    Installation

    ⚠️ This library requires webpack 4 and Node.js 12 or greater.

    $ npm install @tanem/archiver-webpack-plugin --save-dev
    

    License

    MIT

    Install

    npm i @tanem/archiver-webpack-plugin

    DownloadsWeekly Downloads

    17

    Version

    6.1.2

    License

    MIT

    Unpacked Size

    10.4 kB

    Total Files

    6

    Last publish

    Collaborators

    • tanem