What is the difference between electron-builder and electron-rebuild?
Asked Answered
S

1

8

I am trying to find out the difference between electron-builder and electron-rebuild for compiling native modules. Afaik there are these two options to compile my native module dependencies:

electron-builder

"Native application dependencies compilation (including Yarn support)."

    % npm i
    % npm run electron-builder install-app-deps

And there is electron-rebuild

This allows you to use native Node.js modules in Electron apps without your system version of Node.js matching exactly (which is often not the case, and sometimes not even possible).

% npm run electron-rebuild

Both result in a working binary of my dependency. I know electron-builder is used for more, but why does electron-rebuild exist if this can be done via electron-builder as well? Thanks!

Salim answered 13/11, 2020 at 2:41 Comment(0)
U
8

There's also npm rebuild.

The reason that both exist is like the reason that both Windows and Mac exist - but they also both exist for another reason.

Electron-Builder provides a complete solution to build and package your app, and Electron-Rebuild is just for rebuilding dependencies. If you're not using Electron-Builder to package your app, then having it just for its rebuild capabilities seems excessive.

Mostly though, Electron-Rebuild was used back in the day when Electron and Node ABIs didn't match up which made problems for npm rebuild to rebuild node dependencies for Electron - hence the need for a special solution.

I'm no expert on the history and there may be other reasons electron-rebuild exists, but I can't see any use for it today unless you're on old versions of Electron.

Edit: It looks like electron-rebuild may still have some benefits based on this PR

Unshroud answered 25/1, 2021 at 21:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.