DEV Community

Cover image for Build a desktop app with Electron + Vite + React EASYLY
FranDev
FranDev

Posted on

Build a desktop app with Electron + Vite + React EASYLY

To create a Electron proyect with Vite and React desktop app you can to create it in two ways:

  • Electron quick-start
  • Vite

Electron @Quick-Start

Instalation

For create a desktop app with Electron + Vite + React with electron quick-start you need to execute this command:

npm create @quick-start/electron [your_proyect_name]
Enter fullscreen mode Exit fullscreen mode

In the next option you need to choose the frontend framework and in this case you will choose React:

image

In this case, we don't want use Typescript so we won't add it. We will select the option No:

image

We don't want the updater plugin so we will select No:

image

And we don't want the electron dowload mirror proxy so we will select No:

image

Finally, you have your electron proyect with Vite and React created by Electron @Quick-start.

Vite

Instalation

For create a desktop app with Electron + Vite + React with Vite you need to execute the same command for create a Vite proyect:

npm create vite@latest [your_proyect_name]
Enter fullscreen mode Exit fullscreen mode

Now in the frameworks options you will choose Others:

image

In the next option you will can choosing beetwen build a electron proyect with vite or build a vite proyect with other framework and in this option you will choose create-electron-vite:

image

Now you need to select the framework frontend for you electron proyect: Vue, React or Vanilla. In this case you will select React:

image

Finally, you have your electron proyect with Vite and React created by Vite.

The configuration and launching, it is the same like a react proyect

Configuration

npm i
Enter fullscreen mode Exit fullscreen mode

AND

npm install
Enter fullscreen mode Exit fullscreen mode

Launching

npm run dev
Enter fullscreen mode Exit fullscreen mode

RESULTS

Electron proyect created by Electron quick-start:

image

Electron proyect created by Vite:

image

Top comments (0)