INFO Launching Electron…

(node:24312) [DEP0128] DeprecationWarning: Invalid ‘main’ field in ‘C:\xxx\dist_electron\package.json’ of ‘background.js’. Please either fix that or report it to the module author

(Use electron --trace-deprecation ... to show where the warning was created)

解决办法

以上是在说同级目录有index.js文件存在,需要更改electron主进程文件名。 在开发过程中,dist_electron目录会生成两个文件:index.js和package.json,冲突就在这个文件夹,所以我们只需要把index.js文件名修改成background.js就可以了

在vue.config.js

pluginOptions: {
    electronBuilder: {
        chainWebpackMainProcess: (config) => {
            config.output.filename('background.js');
        }
    }
}
Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐