Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CopyWebpackPlugin from array

Tags:

webpack

Is there a way set file paths by an array in CopyWebpackPlugin "from". I mean something like this

new CopyWebpackPlugin([
            {
                from: [
                    './dir1/file1',
                    './dir2/file2',
                ],
                to: 'assets/'
            }
        ])
like image 987
mazza Avatar asked Dec 14 '25 10:12

mazza


1 Answers

You can't use an array, but globs from minimatch
So something like this will work.

new CopyWebpackPlugin([
    { from: './+(dir1|dir2)/+(file1|file2)', to: 'assets/' },
])

Or you just define multiple from to

new CopyWebpackPlugin([
    { from: './dir1/file1', to: 'assets/' },
    { from: './dir2/file2', to: 'assets/' },
])
like image 141
lukas-reineke Avatar answered Dec 16 '25 22:12

lukas-reineke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!