Electron with Angular

Soumyadip
The Dev Newbie
Oct 22, 2020

--

ElectronJS

If you can build a website, you can build a desktop app. Electron is a framework for creating native applications with web technologies like JavaScript, HTML, and CSS. It takes care of the hard parts so you can focus on the core of your application.

Integration with Angular

First, we add Electron into the project by use of the command:

Then, we will need to create an electron.dev.js file under the src folder and insert the following code:

As a next step, we have to adjust some scripts in our package.json. For that we need to install the concurrently package:

Then we add a script that runs Electron:

… and change the start script to:

Lastly, add:

The concurrently module allows us to run the ng serve command and the electron script simultaneously.

We can now run npm start in a terminal and the window will be opened with the loaded Angular application in it.

--

--

Soumyadip
The Dev Newbie

HTML, CSS, Angular and Java amateur at 16 years old. Is also learning UI/UX design as an encore.