ValidationError:选项对象无效。复制插件已使用与 API 架构不匹配的选项对象进行初始化

2024-04-17

由于存在漏洞,我刚刚更新了 package.json 中的一些包。所有漏洞均已修复,但当我执行 npm run 时出现以下错误。 复制插件包在我的漏洞修复过程中得到了更新。

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

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 中的以下部分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') } }),
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ValidationError:选项对象无效。复制插件已使用与 API 架构不匹配的选项对象进行初始化 的相关文章

随机推荐