最新版的CopyWebpackPlugin ,已经改变了ignore的配置方式。
我的版本 copy-webpack-plugin: ^6.0.3
const CopyWebpackPlugin = require('copy-webpack-plugin');
plugins: [
new CopyWebpackPlugin({
patterns: [{
from: path.join(__dirname,'../static'),
to: 'static',
globOptions: {
ignore: [
'**/.*'
]
}
}]
})
]
注意 : ** 两个星号的意思是在当前路径 (我这里匹配的是static/.gitkeep)
参考资料:
https://stackoverflow.com/questions/56670264/copywebpackplugin-ignore-a-folder
https://www.npmjs.com/package/copy-webpack-plugin#globoptions