Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

webpack-del-plugin

smhfanda38MIT License0.0.2

Webpack plugin for deleting files and folders.

webpack-del-plugin, webpack-del-files, webpack-del-file, webpack-del-folder, webpack-del-folders, webpack-del-directory, webpack-del-directories, webpack-del

readme

Description

webpack-del-plugin allow you manage files during compilation process. This plugin using del package.

Usege

  1. Delete all files from dist folder before compiling bundle:

     const path = require('path');
     const WebpackDelPlugin = require('webpack-del-plugin');
     //...
    
     const ROOT_DIR = path.resolve(__dirname);
     const DIST_DIR = path.join(ROOT_DIR, 'dist');
    
     module.exports = {
         // ...
         plugins: [
             // ...
             new WebpackDelPlugin({match: path.join(DIST_DIR, '*.*')})
         ]
     };
  2. Delete particular files:

     const path = require('path');
     const WebpackDelPlugin = require('webpack-del-plugin');
     //...
    
     const ROOT_DIR = path.resolve(__dirname);
     const DIST_DIR = path.join(ROOT_DIR, 'dist');
    
     module.exports = {
         // ...
         plugins: [
             // ...
             new WebpackDelPlugin({
                 match: [
                     path.join(DIST_DIR, 'file1.js'),
                     path.join(DIST_DIR, 'file2.js')
                 ]
             })
         ]
     };