Invalid 'main' field in 'D:\Noot-working\braider\dist_electron\package.json' of 'background.js'.
在运行electron的时候,出现了以下提醒,是因为build后的dist文件有index.js和package.json,冲突出现在这个文件夹,需要我们把文件夹名修改成background.js即可。
Invalid 'main' field in 'D:\Noot-working\braider\dist_electron\package.json' of 'background.js'. Please either fix that or report it to the module authorraider\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)
解决方法:在vue.config.js中添加以下代码:
1 electronBuilder: { 2 chainWebpackMainProcess: (config) => { 3 config.output.filename('background.js'); 4 }, 5 }
最后再运行级不报错啦