![]() |
ElectronJS, with its ability to create cross-platform desktop applications, has become very popular nowadays. When combined with modern tools like Vite and React, it provides a powerful stack for building feature-rich and performant desktop applications. In this article, we’ll learn the stepwise process to initialize a basic template for an ElectronJS project using Vite and React. Prerequisites:
ElectronJSElectronJS is a powerful open-source framework that has the capability to build cross-platform desktop applications using web technologies such as HTML, CSS, and JavaScript/TypeScript. Electron is an open-source project maintained by the OpenJS Foundation. Electron has gained a lots of popularity for its ability to create native-like applications for Windows, macOS, and Linux from a single codebase. Key Features of ElectronJS:
ViteVite is a modern build tool that significantly enhances the development experience for web projects. Known for its speed and simplicity, Vite is an excellent choice for building Electron applications. Key Features of Vite:
When ElectronJS and Vite bundled together, you can harness the strengths of both technologies to create efficient and performant desktop applications. Steps to create Application:Step 1 : Creating a New Vite Project using below command : npm create electron-vite
Step 2 : Configure the project by choosing the right options project name: GFG template using Vite Step 3 : Choose React from the given list to implement your frontend using react : Vue Step 4: Change Directory by running command and run npm install command to install the required packages. cd name_of_your_project Step 5: Add these in Tsconfig.json File so that you can use jsx components in tsx. /* Bundler mode */ Folder Structure: The updated dependencies in package.json file will look like: "dependencies": { Example: Add the below code in the required files. Javascript
CSS
To start the application run the following command. npm run dev
Output: ![]() Working Sample |
Reffered: https://www.geeksforgeeks.org
Node.js |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 13 |