【发布时间】:2022-01-10 09:26:29
【问题描述】:
我使用 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? }
那要怎么做呢?
【问题讨论】:
标签: javascript webpack copy-webpack-plugin