Webapck. Config. Js plguins configuration
When learning Webpack 5, an error occurs when using copy-webpack-plugin to copy files. At first, I thought there was a problem with my configuration or file path. After a series of tests, I found the cause!
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
title: "coderwhy webpack".template: "./source/index.html"
}),
new DefinePlugin({
BASE_URL: '". /"
}),
new CopyWebpackPlugin({
patterns: [{from: "source".globOptions: {
ignore: [
"**/index.html"."**/.DS_Store",]}}]})]Copy the code
Error message
Error reason
There are no files in source folder that can be copied.
The solution
In the Source folder, add files that can be copied.