ValidationError: 无效的选项对象.已使用与 API 架构不匹配的选项对象初始化复制插件 [英] ValidationError: Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema

查看:1778
本文介绍了ValidationError: 无效的选项对象.已使用与 API 架构不匹配的选项对象初始化复制插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于漏洞,我刚刚更新了 package.json 中的一些包.所有漏洞都已修复,但是当我运行 npm 时出现以下错误.在我修复漏洞期间更新了 Copy Plugin 包.

I just updated some of my packages in my package.json due to vulnerabilities. All vulnerabilities were fixed but the following error appeared when I did npm run. Copy Plugin package got updated during my vulnerability fix.

我尝试从较旧的提交中复制 package.json 并重新安装所有软件包,但该漏洞再次出现.

I tried copying package.json from older commits and reinstalling all packages, but then the vulnerability appears again.

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?, toType?, force?, flatten?, transform?, cacheTransform?, transformPath?, noErrorOnMissing? }, ...] (should not have fewer than 1 item)
 - options[1] misses the property 'patterns'. Should be:
   [non-empty string | object { from, to?, context?, globOptions?, toType?, force?, flatten?, transform?, cacheTransform?, transformPath?, noErrorOnMissing? }, ...] (should not have fewer than 1 item)

推荐答案

对于配置问题:

修改 webpack.common.js 中的以下部分:

Adapt the following section in webpack.common.js only:

module.exports = {
  plugins: [
    new CopyWebpackPlugin({
      patterns: [
        { from: Path.resolve('./modules/web/static/'), to: './assets' },
        { from: Path.resolve('./modules/web/static/favicon.ico'), to: './' },
      ]
    }),
    new TsChecker({ typescript: { configFile: Path.resolve('tsconfig.json') } }),

这篇关于ValidationError: 无效的选项对象.已使用与 API 架构不匹配的选项对象初始化复制插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆