有没有办法在 CopyWebpackPlugin "from"中通过数组设置文件路径。我的意思是这样的
new CopyWebpackPlugin([
{
from: [
'./dir1/file1',
'./dir2/file2',
],
to: 'assets/'
}
])
最佳答案
你不能使用数组,而是来自 minimatch 的 globs
所以像这样的东西会起作用。
new CopyWebpackPlugin([
{ from: './+(dir1|dir2)/+(file1|file2)', to: 'assets/' },
])
或者你只定义多个 from to
new CopyWebpackPlugin([
{ from: './dir1/file1', to: 'assets/' },
{ from: './dir2/file2', to: 'assets/' },
])
关于webpack - 从数组中复制 WebpackPlugin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49380507/