当前位置:网站首页>CopyPlugin Invalid Options options should be array ValidationError: CopyPlugin Invalid Options

CopyPlugin Invalid Options options should be array ValidationError: CopyPlugin Invalid Options

2022-06-25 05:05:00 I am Feng Feng Yi

This error is using webpack One of the plugin Errors occurred .
This plugin yes copy-webpack-plugin
I copied the example of the document , Then he reported this error .
Examples of documents

const CopyPlugin = require("copy-webpack-plugin");

module.exports = {
    
  plugins: [
    new CopyPlugin({
    
      patterns: [
        {
     from: "source", to: "dest" },
        {
     from: "other", to: "public" },
      ],
      options: {
    
        concurrency: 100,
      },
    }),
  ],
};

This mistake is about this CopyPlugin The argument received by the constructor is illegal , It needs to pass in a array.

plugins: [
        new CleanWebpackPlugin(),
        new HtmlWebpackPlugin({
    
            template: "./public/index.html",
            chunks: ["main"]
        }),
        new CopyPlugin([{
    
            from: "./public/img",
            to: "./img"
        }]),
    ]
原网站

版权声明
本文为[I am Feng Feng Yi]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202210527410879.html