Copy Plugin has been initialized using an options object that does not match the API schema

本文探讨了在使用CopyWebpackPlugin时遇到的错误,焦点在于如何修正options对象以符合API规范。通过实例展示如何从原始配置['public']调整为对象形式,以确保正确初始化插件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
 - options[0] should be an object:
   object { patterns, options? }
ValidationError: Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.

是plugin配置产生的问题,查看


  plugins: [
    new CleanWebpackPlugin(),
    new CopyWebpackPlugin(['public'])
  ]

修改成

 plugins:[
  new CleanWebpackPlugin(),
  new CopyWebpackPlugin({
    // 'public/**'
   patterns: [
   'public'
    ]  
   })
  ]

 

fanwei@fanweideMacBook-Pro eam % npm run serve  > eam@1.0.5 serve /Users/fanwei/Desktop/项目/ss/eam > vue-cli-service serve  ERROR ValidationError: Invalid options object. Ignore Plugin has been initialized using an options object that does not match the API schema. - options should be one of these: object { resourceRegExp, contextRegExp? } | object { checkResource } Details: * options misses the property 'resourceRegExp'. Should be: RegExp -> A RegExp to test the request against. * options misses the property 'checkResource'. Should be: function -> A filter function for resource and context. ValidationError: Invalid options object. Ignore Plugin has been initialized using an options object that does not match the API schema. - options should be one of these: object { resourceRegExp, contextRegExp? } | object { checkResource } Details: * options misses the property 'resourceRegExp'. Should be: RegExp -> A RegExp to test the request against. * options misses the property 'checkResource'. Should be: function -> A filter function for resource and context. at validate (/Users/fanwei/Desktop/项目/ss/eam/node_modules/webpack/node_modules/schema-utils/dist/validate.js:163:11) at /Users/fanwei/Desktop/项目/ss/eam/node_modules/webpack/lib/util/create-schema-validation.js:26:17 at new IgnorePlugin (/Users/fanwei/Desktop/项目/ss/eam/node_modules/webpack/lib/IgnorePlugin.js:30:3) at Object.<anonymous> (/Users/fanwei/Desktop/项目/ss/eam/vue.config.js:123:15) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! eam@1.0.5 serve: `vue-cli-service serve` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the eam@1.0.5 serve scr
最新发布
03-28
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值