Support modules with bundled prebuilds for electron
See original GitHub issueAll new native modules I’ve been writing, use a new technique where I bundle all prebuilds inside the npm tarball and the pick the right one at runtime. A huge benefit of this is that using these modules with electron just works, no compilation needed.
However when people use electron-rebuild, it forces the prebuilded modules to rebuild by running node-gyp rebuild
instead of running the install script if present in package.json. Ironically this breaks some of my modules that support electron out of the box cause it tries to recompile them without running a preinstall script specificed by the install script.
Anyway to fix this?
As an example try my sodium-native module. It is a native module that works across node/electron without needing any recompilation that breaks when electron-rebuild tries to recompile it, cause it isn’t running the install script instead node-gyp like npm does.
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (3 by maintainers)
Top GitHub Comments
@MarshallOfSound yea you can look for
./prebuilds/{platform}-{arch}/electron-{electron-abi}.node
. fx on macOS (darwin) it’ll look like this,prebuilds/darwin-x64/electron-50.node
. If that file is present you should just skip the recompilation. That’d be super awesome!!FYI, this works perfectly fine,
npm rebuild --runtime=electron --target=$(electron --version) --disturl=https://atom.io/download/atom-shell --abi=$(electron --abi)