使用 electron-builder 为不同 OS 构建原生模块

Build native modules with electron-builder for different OS

我正在使用 electronnodejs 创建一个应用程序,当我尝试使用 electron-builder 使用以下命令构建它时:

electron-builder --mac --linux --win --x64

它只为我当前的 os 构建本机模块。有没有办法为所有操作系统构建本机模块?

你不能。 https://www.electron.build/multi-platform-build

If your app has native dependency, 
it can be compiled only on the target platform unless prebuild is not used.

prebuild is a solution, but most node modules don't provide prebuilt binaries.
macOS Code Signing works only on macOS. Cannot be fixed.