Using CopyWebpackPlugin, I am not able to ignore a specific folder or a specific file. It copies everything.
What I have done in the webpack.config.js:
new CopyWebpackPlugin([
{
from: 'src/assets',
to: 'assets',
ignore: ['src/assets/img/folder/test.png']
},
]),
I also tried like that:
new CopyWebpackPlugin([
{
from: 'src/assets',
to: 'assets',
ignore: ['src/assets/img/folder/*']
},
]),
Regarding the readme I think I am doing right.
New versions of CopyWebpackPlugin have changed the way of ignoring files.
new CopyWebpackPlugin({
patterns: [{
from: defaultSourcePath,
globOptions: {
ignore: [
'**/css/my.css',
'**/js/my.js',
'**/index.html'
]
}
}]
})
Try this:
ignore: ['img/folder/**/*']
This will not copy the entire img/folder
.
Remember to clear your destination folder before running your webpack.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With