问题
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.
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)
回答1:
For the configuration issues:
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') } }),
回答2:
I had the same problem but with angular 11 and with the dependency "@angular-devkit/build-angular": "~0.1100.5" when executing "tns debug android -no--hmr".
When I updated nativescript to version 7 the file "webpack.config.json" changed the CopyWebpack, and I solved the error by entering the previous configuration as you can see in the image.
来源:https://stackoverflow.com/questions/63379652/validationerror-invalid-options-object-copy-plugin-has-been-initialized-using