- 若修改
DNS
可能会导致npm
安装失败。 - 本博客主要讲述Electron 12.0.9及之后的版本。如果使用之前的版本,请注意:Electron 10.0.0 之前的版本(不包含10.0.0)可在渲染进程中使用
remote
,10.0.0 及之后的版本(包含10.0.0)不可使用remote
,需要额外增加一个开发依赖'@electron/remote
,参见官网:https://github.com/electron/remote - vue 中使用node,需要在
vue.config.js
文件中设置nodeIntegration
:module.exports = { pluginOptions: { electronBuilder: { nodeIntegration: true, externals: ['ffi-napi'] } } }
- DLL调用需要设置
ffi-napi
不打包,并将dll文件直接拷贝到项目中(DLL不打包在resources\app.asar
中):module.exports = { pluginOptions: { electronBuilder: { nodeIntegration: true, externals: ['ffi-napi'], builderOptions: { extraResources: [ { from: "./dll/arithmetic-operations_ia32.dll", to: "../dll/arithmetic-operations_ia32.dll" }, { from: "./dll/arithmetic-operations_x64.dll", to: "../dll/arithmetic-operations_x64.dll" } ] } } } }
Electron 12 学习 说明
于 2021-05-23 20:42:44 首次发布