一开始以为是 webpack 问题,于是配置了:
node: {
...,
global: true,
},
但发现,啥用没有,后来经过测试,才知道,在 electron 13 中,需要对窗口设置这个属性才行:
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
}
尤其是:contextIsolation。 问题解决!
一开始以为是 webpack 问题,于是配置了:
node: {
...,
global: true,
},
但发现,啥用没有,后来经过测试,才知道,在 electron 13 中,需要对窗口设置这个属性才行:
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
}
尤其是:contextIsolation。 问题解决!
本文标题:electron + react + webpack 中遇到:
本文链接:https://www.haomeiwen.com/subject/jxedxrtx.html
网友评论