NoteDeep
Electron 是一个由 GitHub 开发的开源库,通过将 Chromium) 和Node.js 组合并使用 HTML,CSS 和 JavaScript 进行构建 Mac,Windows,和 Linux 跨平台桌面应用程序。


简单记录一下坑的地方
参考文章是:https://leo.im/2017/electron-next

1、绝对路劲问题
// const prodPath = path.resolve('renderer/out/start/index.html'); 这个地方有问题,并没有办法拿到绝对路径。
要这样才可以
const prodPath = `file://${path.join(__dirname, './renderer/out/start/index.html')}`;

2、Object.values()报错
Node.js版本低了,需要 nvm use v8.12.0 一下

3、最终使用的合适版本
"devDependencies": { "electron": "^4.0.1", "electron-builder": "^20.38.4", "next": "^7.0.2", "react": "^16.7.0", "react-dom": "^16.7.0" }, "dependencies": { "electron-is-dev": "^1.0.1", "electron-next": "^3.1.5" }








评论列表