M
M
Maxim js2021-03-16 09:16:03
JavaScript
Maxim js, 2021-03-16 09:16:03

Why can't copy-webpack-plugin find the path?

new CopyWebpackPlugin({
            patterns: [
                {
                    from: path.resolve(__dirname, './src/assets'),
                    to: path.resolve(__dirname, './dist/assets'),
                }
            ],
        }),


gives an error message
ERROR in unable to locate 'C:/Users/Admin/Desktop/vue project/webpack-start-frontend/src/assets/**/*' glob

I've tried everything, still the same error

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AlekseyOgorodnikov, 2021-05-24
@AlekseyOgorodnikov

You need to add the noErrorOnMissing: true option, which will tell the collector if the folder is empty, then skip it and don't generate an error.
{
//Copy assets
from: path.resolve(__dirname, "./src/assets"),
to: path.resolve(__dirname, "./dist/assets"),
noErrorOnMissing: true,
}
You just have an empty folder.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question