侧边栏壁纸
  • 累计撰写 57 篇文章
  • 累计创建 98 个标签
  • 累计收到 5 条评论

目 录CONTENT

文章目录

electron 打包 node模块无法使用

Sir丶雨轩
2019-11-16 / 0 评论 / 1 点赞 / 621 阅读 / 265 字

electron5.x的node集成环境默认是关闭的,这之前的版本是默认开启的。

所以,为了保持前后兼容,建议显示配置集成node环境,即nodeIntegration为true。

var win = new BrowserWindow({
    width: 600,
    height: 800,
    webPreferences: {
       nodeIntegration: true
    }})
1

评论区