clean-webpack-plugin icon indicating copy to clipboard operation
clean-webpack-plugin copied to clipboard

Excluding files & folders not working

Open necm1 opened this issue 4 years ago • 1 comments

Issue description or question

Writing ! before file and / or folder seems not to work. My file & folder is still getting removed after the build succeed.

Webpack Config

    plugins: [
        new CleanWebpackPlugin({
            protectWebpackAssets: false,
            cleanAfterEveryBuildPatterns: ['*.LICENSE.txt', '!manifest.json', '!assets/**']
        })
    ]

Environment

 System:
    OS: Windows 10 10.0.22000
    CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
    Memory: 7.16 GB / 15.44 GB
  Binaries:
    Node: 17.1.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    clean-webpack-plugin: ^4.0.0 => 4.0.0
    webpack: ^5.64.1 => 5.64.1

necm1 avatar Nov 18 '21 07:11 necm1

Add this to the configuration:

        cleanOnceBeforeBuildPatterns: [
          '**/*',
          '!manifest.json', 
           '!assets/**'
        ],     

kachaj7 avatar Dec 07 '21 08:12 kachaj7