我使用 copy-webpack-plugin 10.2.0 和 webpack 5.65.0。我想将文件public/js
夹中的 js 文件复制到dist/js
.
plugins: [
new CopyWebpackPlugin({
patterns:[
{
from:'public/js/*.js',
to:path.resolve(__dirname, 'dist','js'),
}
]
})
],
但是设置也将路径复制到dist中,它变成了dist/js/public/js
。我尝试添加flatten:true
但它有错误
Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
- options.patterns[0] has an unknown property 'flatten'. These properties are valid:
object { from, to?, context?, globOptions?, filter?, transformAll?, toType?, force?, priority?, info?, transform?, noErrorOnMissing? }
那怎么弄呢?