johnagan / clean-webpack-plugin

A webpack plugin to remove your build folder(s) before building

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Excluding files & folders not working

necm1 opened this issue · comments

commented

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

Add this to the configuration:

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