What's the difference between the installer and win-unpacked folder in an electron-builder dist folder?

Viewed 739

I am new to electron trying to figure the basics of the distribution concept.

I have built a basic electron app for windows with the electron-builder.

The generated dist folder contains an installer, the My App Setup 0.1.0.exe and a win-unpacked folder with a My App.exe

The installer opens a setup window first, installs something somewhere, and then runs my app.

The My App.exe runs My App directly.

  1. What is the exact purpose of the installer?
  2. Does it really install something and where?
  3. What is the purpose of the win-unpacked folder?
  4. Which one is meant for distribution?
  5. What is the .blockmap for?

enter image description here

1 Answers

Although you're asking multiple questions at once, all of them are pretty easily answerable in one stringent answer. To sum up (TL;DR), when creating an installer, you first have to compile the app and all resources which are meant to be contained in the installer executable, which is what the win-unpacked folder is for.


But, to answer your questions from 1 to 4, I'll go a little more into the details:

  1. The installer is meant for distribution. It will install your app on the local Windows drive and make the application accessible via the start menu (and possibly via a Desktop shortcut). It packages all files needed (those under win-unpacked into a single file which makes your life easier when publishing your app.
  2. Yes. See above. The specifics will differ based upon your settings and your build configuration, but it actually does.
  3. This the the place where Electron Builder temporarily stores all files which will need to go into the installer executable. I believe this is the exact same thing you'd get when building the standalone target. The reason this folder is not deleted is (I think, but can't verify) to allow for incremental builds, i.e. so that Electron Builder does not have to copy your resources every time you build the application when nothing actually changed (besides code).
  4. You could zip up the win-unpacked folder, but you'd lose installation registration (your app, when installed, will be un-installable from within Windows Settings), shortcuts in the start menu and on the desktop, etc. I'd prefer the installer.
  5. It's a tool to make sure that the files inside the installer aren't corrupted or incomplete, see this issue on GitHub.

In terms of which mode of distribution to choose, that's actually up to you. But if you think you can't trust your users to correctly find and start the application when it's not in the start menu / on the desktop, the installer most definitely is the way to go. And, don't trust your users and always assume that no-one of them ever had opened your app. That way it's pretty easy to keep the application super user-friendly.

Related