Q: process打印不出来

A: 需要在main.js中的BrowserWindow中添加配置

如果是16.X.X以下,那么

1
2
3
4
5
6
7
const win = new BrowserWindow({
// ...
webPreferences: {
// ...
nodeIntegration: true
}
})

如果是16.X.X,则

1
2
3
4
5
6
7
8
const win = new BrowserWindow({
// ...
webPreferences: {
// ...
nodeIntegration: true,
contextIsolation: false
}
})

**W:**16.X.X以上版本的bug

最后更新: 2021年12月01日 10:05