Been working on a Electron and React app for the past 4 months and we are getting close to releasing it. This is my first production Electron app and I noticed the unpacked size was very large and the app.asar contained over 100mb of node_modules.
TLDR: does my built electron app actually need node_modules included in the build (built for linux and armv7l)? I know the react app does not after being built. And my temp work around has been moving my react deps to devDependencies so electron-builder ignores them. -- (I know this is not best practice because deploying the react app alone with a lot of services will only read the production dependencies - but shouldn't be an issue for our app's deployment)
No, you should not need to include your node_modules in the electron build. Most of the required dependencies should be transpiled into the build folder.
Docs here: https://www.electronjs.org/docs/latest/tutorial/using-native-node-modules
You should also be able to test this our pretty easily. Remove node_modules from the build target and test after running build.