// This file is required by the index.html file and will
// be executed in the renderer process for that window.
// No Node.js APIs are available in this process because
// `nodeIntegration` is turned off. Use `preload.js` to
// selectively enable features needed in the rendering
// process.
这句话很重要就是,理解起来就是,这个renderer.js 不可以使用node.js,如果要使用,你需要去,启动XXXXX
看到这句话,百度起来就快了,网上给的答案在主进程中创建webPreference中修改他
nodeIntegration:true(默认的是false)
自问,我为啥呢么二,我也写了,然后再运行,报错依旧,我就很着急呀,why,
划重点:我拼错了,,,如果你也入坑,请仔细仔细检查,你是不是也把这个写错了。正确的写法是
webPreferences: {
//注意大小写
nodeIntegration:true,
preload: path.join(__dirname, ‘preload.js‘)
}