Hi,
Thanks for this plugin 馃憤
I have a static folder I want to copy to the dist folder. This folder contains three folders, like so:
I want to copy these folders, regardless if they have content. Is that possible?
I currently have the following setup, and it only creates the folders in dist when they contain files:
new CopyWebpackPlugin([
{
context: path.join(paths.www, 'static'),
from: '**/*',
to: 'static',
}
], {
copyUnmodified: true
})
Is this not possible, or is there something with my config?
Unfortunately, this is a limitation with webpack. It can't create empty folders. Only files, not directories, can be added to compilation.assets, which is how we use webpack to write the files. You could, in theory, add a '.empty' file to each directory to ensure they appear.
Is this still a limitation with webpack, three years later?
Id like to know how to copy empty folders lol
Tried it with webpack 4.44.2 and it's still an issue
Just add an empty file like .gitkeep file inside the directory you want to be copied
This way CopyWebpackPlugin will copy those empty folders (because they are not empty anymore)
Also, you can track those folders, for example with .gitignore
Most helpful comment
Is this still a limitation with webpack, three years later?