This is a template for creating cross-platform desktop applications (Windows, macOS, and Linux) using Electron, Vite, React, and TypeScript. This project allows transforming React web applications into desktop applications while maintaining compatibility with all React libraries and frameworks.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- Configure the top-level
parserOptions
property like this:
export default {
// other rules...
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
}
- Replace
plugin:@typescript-eslint/recommended
toplugin:@typescript-eslint/recommended-type-checked
orplugin:@typescript-eslint/strict-type-checked
- Optionally add
plugin:@typescript-eslint/stylistic-type-checked
- Install eslint-plugin-react and add
plugin:react/recommended
&plugin:react/jsx-runtime
to theextends
list
- Node.js (v21.5.0 or higher)
- npm ( v10.8.1 or higher)
-
Clone the repository:
git clone https://github.com/Marco-Centeno/Electron-Vite-React-TS.git
-
Into the root directory of this project install the dependencies
npm install
-
Test in a development mode
Use the command
npm run dev
For runing the programm in a developnet mode non-production
-
Build Project
You can add other command of Electron-Builder before the command of build
- Building for different OS
-
Windows
npm run build:win
-
Mac
npm run build:mac
-
Linux
npm run build:lin
-
- You can also use custom building commands of electron builder
- If you want to use custom electron builder commands in the CLI just use the command
npm run build
and then use the other commands that you want - You can clic herek for the official commands documentation
- If you want to use custom electron builder commands in the CLI just use the command
- Building for different OS