clean-webpack-plugin

  • Version 4.0.0
  • Published
  • 35.7 kB
  • 1 dependency
  • MIT license

Install

npm i clean-webpack-plugin
yarn add clean-webpack-plugin
pnpm add clean-webpack-plugin

Overview

A webpack plugin to remove/clean your build folder(s).

Index

Classes

class CleanWebpackPlugin

class CleanWebpackPlugin {}

    constructor

    constructor(options?: Options);

      method apply

      apply: (compiler: Compiler) => void;

        method handleDone

        handleDone: (stats: Stats) => void;

          method handleInitial

          handleInitial: (compilation: Compilation) => void;
          • Initially remove files from output directory prior to build.

            Only happens once.

            Warning: It is recommended to initially clean your build directory outside of webpack to minimize unexpected behavior.

          method removeFiles

          removeFiles: (patterns: string[]) => void;

            Interfaces

            interface Options

            interface Options {}

              property cleanAfterEveryBuildPatterns

              cleanAfterEveryBuildPatterns?: string[];
              • Removes files after every build (including watch mode) that match this pattern. Used for files that are not created directly by Webpack.

                Use !negative patterns to exclude files

                default: []

              property cleanOnceBeforeBuildPatterns

              cleanOnceBeforeBuildPatterns?: string[];
              • Removes files once prior to Webpack compilation Not included in rebuilds (watch mode)

                Use !negative patterns to exclude files

                default: ['**/*']

              property cleanStaleWebpackAssets

              cleanStaleWebpackAssets?: boolean;
              • Automatically remove all unused webpack assets on rebuild

                default: true

              property dangerouslyAllowCleanPatternsOutsideProject

              dangerouslyAllowCleanPatternsOutsideProject?: boolean;
              • Allow clean patterns outside of process.cwd()

                requires dry option to be explicitly set

                default: false

              property dry

              dry?: boolean;
              • Simulate the removal of files

                default: false

              property protectWebpackAssets

              protectWebpackAssets?: boolean;
              • Do not allow removal of current webpack assets

                default: true

              property verbose

              verbose?: boolean;
              • Write Logs to Console (Always enabled when dry is true)

                default: false

              Package Files (1)

              Dependencies (1)

              Dev Dependencies (25)

              Peer Dependencies (1)

              Badge

              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/clean-webpack-plugin.

              • Markdown
                [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/clean-webpack-plugin)
              • HTML
                <a href="https://www.jsdocs.io/package/clean-webpack-plugin"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>