I build and run many Electron apps on Windows. I noticed that all of them have the same common api files / libraries to run. They all take about 30mb of space.

I'm thinking of installing these files in the system, maybe moving them to system32 folder or the GAC, and then removing them from all my electron apps.

I would have an installer package for electron files, let's say "electron-dependencies" a bit like a regular redist package that can be is installed, and once it's there, all Electron apps run using the same files with much smaller size.

Would this actually work? Any drawbacks or thoughts on this?

I believe in the future Microsoft could support Electron (they already do with VSCode and maybe with their new Chrmoium Browser) by including these libraries on Windows out of the box.

  • It would make a lot more sense if Electron apps used a shared copy of the browser engine, much like Cordova apps do. But I think that's probably something best left to OS vendors. – GrandmasterB Dec 12 '18 at 21:20


From the Electron tutorial:

At this point, you'll need to install electron itself. The recommended way of doing so is to install it as a development dependency in your app, which allows you to work on multiple apps with different Electron versions.

This is a clear advice that if you try to install Electron libraries just once inside the system32 folder or a similar central place, and not inside each application's folder, you cannot easily mix different versions. Worse, you might produce version conflicts with other Electron apps where you are not the author and which definitely use a different Electron lib version than your apps.

So don't make the same error as Microsoft several years ago, when they provided just one MFC.DLL and one MSVCRT.DLL directly in the Windows system folder, allowing each program just to install a newer version of those DLLs by replacing the older ones (and sometimes replacing newer versions by older ones). This caused so much trouble that this phenomenon got the name "DLL hell".

Of course, today, modern Windows systems have means and conventions to provide different versions of the same libraries and frameworks in parallel. For example, the global assembly cache (GAC) you mentioned is designed specificially to avoid version conflicts. But its usage is restricted to .NET libraries ("assemblies"), and AFAIK Electron is node.js based, not .NET framework based, so better follow the instructions from their manual.

Not the answer you're looking for? Browse other questions tagged or ask your own question.