Copy-webpack-plugin: options.dirs undefined is required

Created on 22 May 2019  路  3Comments  路  Source: webpack-contrib/copy-webpack-plugin

When using this plugin, I get the error:

webpack-copy-plugin: options.dirs undefined is required.

In my webpack config I defined:

    plugins: [
        new CopyPlugin([{
            from: './node_modules/reload/lib/reload-client.js',
            to: './public/reload-client.js',
            toType: 'file'
        }])]

I'm running node v11.9.0 on Mac OSX High Sierra.

No idea what the error means. It should work no?
Thanks.

Most helpful comment

This made me laugh, I did exactly the same. Thanks for pointing that out. 馃憤

All 3 comments

I found out what the problem is.
The format requires:

new CopyPlugin({ dirs: [{
            from: './node_modules/reload/lib/reload-client.js',
            to: './public/reload-client.js',
            toType: 'file'
        }]}

But honestly, please update your documentation if you make changes to the code.
The github frontpage for this library is in fact wrong.

Seems I was looking at webpack-copy-plugin instead of copy-webpack-plugin.

This made me laugh, I did exactly the same. Thanks for pointing that out. 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jdeniau picture jdeniau  路  5Comments

dmarcautan picture dmarcautan  路  5Comments

stq picture stq  路  5Comments

Jocs picture Jocs  路  4Comments

alexprice1 picture alexprice1  路  5Comments