Open ben4d85 opened 4 years ago
I was confused as well. I think this setting overrides the default include so you have to put it back.
To clean your output, but exclude a whole directory, this should do the trick:
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: ['**/*', '!.git', '!.git/**/*']
})
@johnagan Can you simplify the option to exclude directories?
Now
cleanOnceBeforeBuildPatterns: ['**/*', '!dir', '!dir/**/*']
Expect
cleanOnceBeforeBuildPatterns: ['**/*', '!dir']
If a directory is allowed to be emptied, then this directory should also be deleted.
I was able to exclude a directory and all its subdirectories/files using
cleanOnceBeforeBuildPatterns: ['**/*', '!dir/**']
Issue description or question
When using webpack-clean, what option do I need to pass to keep a whole directory, i.e. to ensure the directory does not get deleted?
Example
My output directory is
dist
. I wantindex.js
to be deleted, but I want to keep the.git
folder.Attempt
I have tried the following. But this stops it from deleting anything at all. Might it have to do with the
.
in.git
? What is the correct way to use this, please?