Electron-builder: Set platform npm environment variable

Created on 18 Dec 2016  路  5Comments  路  Source: electron-userland/electron-builder

  • Version: 10.8.1

  • Target: all


prebuild now fully supports Electron and works great together with electron-builder and the npmSkipBuildFromSource option.

Additionally it would be great if electron-builder could expose the platform it builds for to a npm environment variable (npm_config_platform) during the rebuilding of native modules.

This way prebuild would be able to download the correct prebuilt binary for the desired target.
This would make multi platform builds with native dependencies possible.

feature

Most helpful comment

Will be implemented soon.

All 5 comments

@lgeiger I actually added support for this on my own branch but never PR'd it because it was a bit hacky.

https://github.com/mmckegg/electron-builder/commit/e0936afe3701f6507a2856ea7ee4421e5c0a2af9

~@mmckegg Would you like to send PR?~

Will be implemented soon.

@develar Thanks for the fast response!

I just tried v10.9.0 and it doesn't fully work yet:

$ npm run pack

> [email protected] pack /Users/lukasgeiger/code/nteract
> npm install && npm run clean && npm run build && build --dir --linux

> [email protected] postinstall /Users/lukasgeiger/code/nteract
> install-app-deps

Rebuilding native production dependencies for darwin:x64

I use build --dir --linux and it still builds for mac (darwin:x64). Or am I missing something.

I'm sorry, the log (Rebuilding native production dependencies for darwin:x64 was coming from the npm install command.

I'll investigate further.

Was this page helpful?
0 / 5 - 0 ratings