Electron builder vs snapcraft

Hi guys,

I have one question to all you.

Which is the best way to generate my own electron app snap? Electron-builder or snapcraft? Are there any diferences between these two approaches?

In case, you say that I should choose a path and follow it, I’d like to hear from you which the advantages and disadvantages of following one or another path are.

An additional piece of information that also may influence your inputs, my application is digital signage app and my ultimate goal is to have installed together with mir-kiosk.


electron-builder is a popular option and can be quite handy! However, it’s a third party application that wraps up a number of Snapcraft capabilities which can sometimes add challenges for complex projects.

If you are currently using elecron-builder, then I’d suggest you continue to do so unless it presents a problem :smiley:

If you are not, another option is to use electron-packager directly with snapcraft: https://github.com/cjp256/electron-snap-examples/blob/master/electron-packager-hello-world/snapcraft.yaml

This option gives you the most flexibility from a Snapcraft perspective, but lacks some conveniences of electron-builder.

Whatever you decide, I’m interested in hearing about your experiences :smiley:

FWIW, once core20 has a supported gnome extension, I intend to add an electron-packager plugin to further simplify the above example.

Thanks @cjp256 for your input.

My point is if I had to choose one approach I would definitely choose continuing to build snaps the same way that I’ve been doing so far (using electron builder), because it wouldn’t change nothing for me.

However, and considering that my use case is to run this snap in a ubuntu core machine and integrating it with mir-kiosk, I’m slightly concerned about what expecting from this snap once I install it (in the ubuntu core machine which has also installed mir-kiosk). I didn’t specified any plugs (although I know that I could do it).

Does anyone knows if electron builder does this specification per si or should I do it manually? And what would be expected if I install my snap and run in the final machine? Should the integration with mir-kiosk be straightforward or should I anticipate any problems?

While electron-builder is a fine thing for standard stuff, it really gets tricky if you want to do something that requires a bit more adjustments, overrides and tweaks for a specific use-case … electron-packager is definitely a lot more flexible, i do all my electron snaps with electron-packager nowadays … here is an example:

1 Like

What the others before me mentioned is definitely correct. If you want the power of electron builder for packaging the node stuff combined with the flexibility of your own snap.yml, you can also configure electron builder with the dir target, creating an unpackaged distribution for linux, and then wrap that in your snap.yml. That’s what we do in the UBports Installer:

1 Like