【前端开发】Webpack electron打包--ValidationError: Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema

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)
vue.js
npm
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') } }),
        //cesium相关资源目录需要拷贝到系统目录下面
            // new CopyWebpackPlugin([{
            //     from: path.join(cesiumSourcePath, 'Workers'),
            //     to: path.join(config.output.path, cesiumRunPath, 'Workers')
            // }]),
            // new CopyWebpackPlugin([{
            //     from: path.join(cesiumSourcePath, 'Assets'),
            //     to: path.join(config.output.path, cesiumRunPath, 'Assets')
            // }]),
            // new CopyWebpackPlugin([{
            //     from: path.join(cesiumSourcePath, 'ThirdParty'),
            //     to: path.join(config.output.path, cesiumRunPath, 'ThirdParty')
            // }]),
            // new CopyWebpackPlugin([{
            //     from: path.join(cesiumSourcePath, 'Widgets'),
            //     to: path.join(config.output.path, cesiumRunPath, 'Widgets')
            // }])
new CopyWebpackPlugin({
                patterns: [{
                        from: path.join(cesiumSourcePath, 'Workers'),
                        to: path.join(config.output.path, cesiumRunPath, 'Workers')
                    },
                    {
                        from: path.join(cesiumSourcePath, 'Assets'),
                        to: path.join(config.output.path, cesiumRunPath, 'Assets')
                    },
                    {
                        from: path.join(cesiumSourcePath, 'ThirdParty'),
                        to: path.join(config.output.path, cesiumRunPath, 'ThirdParty')
                    },
                    {
                        from: path.join(cesiumSourcePath, 'Widgets'),
                        to: path.join(config.output.path, cesiumRunPath, 'Widgets')
                    }
                ]
            }),

 

posted @ 2022-02-26 19:30  咸鱼翻身  阅读(2728)  评论(0编辑  收藏  举报