Copy Plugin版本问题

我的版本 =>

    "copy-webpack-plugin": "^6.3.1",

运行

 npx  webpack

报错 =>

[webpack-cli] ValidationError: Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
- options[0] misses the property 'patterns'. Should be:
  [non-empty string | object { from, to?, context?, globOptions?, filter?, toType?, force?, flatten?, transform?, cacheTransform?, transformPath?, noErrorOnMissing? }, ...] (should not have fewer than 1 item)
   at validate (H:\ld\task\code\Webpack\02\node_modules\schema-utils\dist\validate.js:104:11)
   at new CopyPlugin (H:\ld\task\code\Webpack\02\node_modules\copy-webpack-plugin\dist\index.js:54:31)
   at Object.<anonymous> (H:\ld\task\code\Webpack\02\webpack.config.js:14:9)
   at Module._compile (H:\ld\task\code\Webpack\02\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
   at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10)
   at Module.load (internal/modules/cjs/loader.js:982:32)
   at Function.Module._load (internal/modules/cjs/loader.js:875:14)
   at Module.require (internal/modules/cjs/loader.js:1022:19)
   at require (H:\ld\task\code\Webpack\02\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
   at requireConfig (H:\ld\task\code\Webpack\02\node_modules\webpack-cli\lib\groups\resolveConfig.js:73:18) {
 errors: [
   {
     keyword: 'required',
     dataPath: '[0]',
     schemaPath: '#/required',
     params: [Object],
     message: "should have required property 'patterns'",
     schema: [Object],
     parentSchema: [Object],
     data: [Object],
     children: [Array]
   }
 ],
 schema: {
   definitions: { ObjectPattern: [Object], StringPattern: [Object] },
   type: 'object',
   additionalProperties: false,
   properties: { patterns: [Object], options: [Object] },
   required: [ 'patterns' ]
 },
 headerName: 'Copy Plugin',
 baseDataPath: 'options',
 postFormatter: null
}

参考 => https://www.npmjs.com/package/copy-webpack-plugin
解决 =>

        new CopyPlugin({
            patterns: [
                { from: "static", to: "static" }
            ],
        })
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值