Blog

Creating .exe files with HTML, JS, and CSS

Creating .exe files with HTML, JS, and CSS

Today I will talk a little about my journey creating .exe files using HTML, JS, and CSS. In this case, .exe files are Windows executables. While researching possible alternatives, the ones I found that seemed viable were:

Below I will comment on my experience with each one and explain why I chose Tauri, at least initially.

Nw.js

My initial idea was to use Nw.js because it had some advantages, such as JavaScript code protection. However, in my initial tests, when generating the .exe, Windows Defender immediately flagged the executable as a virus. That made me give up on using the tool.

I even opened an issue on GitHub about it, but there was not much that could be done. What still makes me curious is why this does not happen with Electron.

Electron

My second alternative was Electron. In some ways, it would be the best choice for what I wanted to do, especially because Electron Builder has an option to generate .apk files for Android, although I still have not tested that.

But, as always, Electron has disadvantages. For my use case, the biggest ones were performance and executable size, which made me give up on Electron.

The points that made me give up were:

  1. A simple production executable generated around 70 MB.

  2. Slow application startup, requiring a splash screen when using Electron with Angular, which was the purpose of my tests.

Tauri

For this purpose, my choice was Tauri. It is not perfect either, but it solves Electron's problems, which in my view is already very valuable.

The final executable generated with Tauri was 5 MB. This was also using Angular. I left a POC repository using both here: https://github.com/andreescocard/tauri-angular/tree/master

Anyone downloading Tauri from scratch and using it with Angular will probably see an error when running npm run tauri dev. This happens because of 2 lines, 3 and 5, that need to be changed as shown here. I remember opening an issue about this, but for some reason it did not save, and now I am too lazy to open it again.

Tauri is a recent but very promising tool. It still does not generate installers for mobile devices, although I think I have seen something about it in the issues, but I did not look deeper.

Here is a quick explanation of what Tauri is:

In the end, Tauri will be my choice for creating .exe files with HTML, JS, and CSS in 2023, at least for now.

Comments

Join the conversation

Loading comments...