Reputation: 39
I have an electron app with 2 package.json files.
The root/package.json
has all devDependencies, and the root/app/package.json
has all dependencies which is necessary for app running.
So I package app
folder using electron-packager, then build installer for windows using inno setup.
But when I install the app, because the node_modules
in app
has too many dependencies, the installer is so slow in order to extract all contents from node_modules
.
Other apps cost 3-10s for installing, but mine 25-35s.
So what should I do for this? Maybe I can bundle the js using webpack before packaging?
Thanks.
Upvotes: 1
Views: 1627
Reputation: 1213
Are you packaging a web app into electron? The slow packaging time is probably because of bundling web node modules into the electron app which is not necessary.
https://medium.com/@hellobharadwaj/electron-plus-angular-react-why-use-2-different-package-json-files-361ae47d07f3
Upvotes: 0
Reputation: 1628
You should absolutely use something like webpack
(or equivalent) to bundle your application. Webpack does an excellent job at tree-shaking your dependencies and only keeping the resultant necessary modules.
I have already posted a possible solution for electron projects, including a build process approach that leads to installation building. My particular recommendation leaned on utilizing Wix for MSI deployment but the build process items are still applicable (steps 1-6) for anyone wanting to understand a possible process for the items important to doing this work (even if you use another installer). Hope this helps:
https://stackoverflow.com/a/46474978/3946706
Upvotes: 1