An extremely lightweight Electron template with Vite, React, TypeScript, and Tailwind CSS, optimized to compile under 60-75MB.
- ⚡ Vite - Lightning fast build tool
- ⚛️ React 18 - Latest React with TypeScript
- 🎨 Tailwind CSS - Utility-first CSS framework
- 📦 Electron - Cross-platform desktop apps
- 🔒 Security - Context isolation and secure defaults
- 📦 Optimized Bundle - Aggressive minification and tree-shaking
- 🎯 Size Target - Compiled app under 60-65MB
ultra-light-electron-app/
├── electron/
│ ├── main.ts # Main Electron process
│ └── preload.ts # Preload script
├── src/
│ ├── types/
│ │ └── electron.d.ts # Electron type definitions
│ ├── App.tsx # Main React component
│ ├── main.tsx # React entry point
│ └── index.css # Tailwind CSS
├── index.html # HTML template
├── package.json # Dependencies and scripts
├── vite.config.ts # Vite configuration
├── tailwind.config.js # Tailwind configuration
├── postcss.config.js # PostCSS configuration
├── tsconfig.json # TypeScript configuration
├── tsconfig.node.json # TypeScript Node configuration
└── electron-dev.js # Development server script
-
Create project directory:
mkdir ultra-light-electron-app cd ultra-light-electron-app -
Create all the files from the template above
-
Install dependencies:
npm install
-
Development mode:
npm run electron:dev
-
Build for production:
npm run dist
This happens when trying to run Electron before building. Solution:
- Make sure you've created all files from the template
- Run
npm installfirst - Use
npm run electron:devfor development (notelectron .directly) - For production, run
npm run distwhich builds everything first
-
Create the folder structure:
ultra-light-electron-app/ ├── electron/ (create this folder) ├── src/ │ └── types/ (create this folder) -
Copy all files from the artifacts above into their respective locations
-
Install dependencies:
npm install
-
Start development:
npm run electron:dev
- Terser minification with aggressive compression
- Tree shaking to remove unused code
- Source maps disabled in production
- Console.log removal in production builds
- Maximum compression in electron-builder
- Minimal preload API - Only essential functions exposed
- No dev tools in production
- No app icon to save space
- Security-first configuration
- Single process architecture
- Tailwind purging - Removes unused CSS classes
- Minimal custom CSS - Only essential styles
- PostCSS optimization
- Minimal dependencies - Only essential packages
- No unnecessary features - Icons, sounds, etc. removed
- Optimized React imports
The template is configured to produce:
- Windows (NSIS): ~45-55MB
- macOS (DMG): ~50-60MB
- Linux (AppImage): ~60-65MB
npm run dev- Start Vite dev server onlynpm run electron:dev- Start Electron in development modenpm run build- Build and package the appnpm run dist- Create distribution packagesnpm run dist:dir- Build unpacked directory (for testing)
- Always use
npm run electron:devfor development, notelectron . - Build before distributing with
npm run dist - The
dist-electronfolder is created automatically during build - Don't run Electron directly until after the first build
This template prioritizes size optimization while maintaining developer experience and modern tooling.