electron / rebuild

Package to rebuild native Node.js modules against the currently installed Electron version
MIT License
1.02k stars 175 forks source link

Exclude modules #573

Open Christilut opened 3 years ago

Christilut commented 3 years ago

Is there a way to exclude certain modules? There is onlyModules to do the opposite, but it's not very practical if you need to exclude a module to always have to keep onlyModuels up to date.

Also, is there a way to get electron-rebuild to list all the modules it's building? If I want to add all my current modules in onlyModules except one, I have no idea right now what modules it's actually building.

malept commented 3 years ago

What is the use case for excluding modules? An example would also be helpful.

Christilut commented 3 years ago

I'm using @journeyapps/sqlcipher but it is incompatible with electron-rebuild (see here). The suggested workaround is to use onlyModules but that means I have to explicitly include modules I do want to use there.

dko-slapdash commented 3 years ago

@malept Another usecase is to exclude fsevents module on e.g. MacOS. Typically, fsevents is used by dev tools like tsc --watch, cpx, webpack --watch etc., and electron-rebuild rebuilds this module too which causes watch-mode to stop working silently (chokidar internally used in all these tools just silently switches to polling mode which kills CPU).

If we had --exclude in electron-rebuild package, then we'd be able to tell it to not rebuild fsevents and thus keep the dev tools intact.

dko-slapdash commented 3 years ago

...Notice that packages like chokidar, jest-haste-map etc. have fsevents in package.json's optionalDependencies (which makes sense). That's why I guess electron-rebuild rebuilds it too.

jeremymurray commented 3 years ago

We're also currently running into this issue specifically for fsevents on windows (where we need it on osx builds). An omit would be nice or some way to ignore and continue if a build fails.

aguynamedben commented 3 years ago

My use case for wanting this: using node-sqlite3, but with SQLCipher, so I want to run a custom node-gyp for that rebuild only.

aguynamedben commented 3 years ago

Here's the command we have to use

$ electron-rebuild --only @adeperio/forcefocus,@hypersprite/vscode-windows-registry,@nodert-win10-rs4/windows.foundation,@nodert-win10-rs4/windows.system,@sentry/electron,@slack/web-api,evernote,extract-file-icon,jsforce,keyboard-layout,keytar,node-abi,node-fetch,plist,sequelize
✔ Rebuild Complete
✨  Done in 9.71s.

What would be nice

$ electron-rebuild --exclude sqlite