-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
91 lines (83 loc) · 2.11 KB
/
vite.config.ts
File metadata and controls
91 lines (83 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/**
* @file vite.config.ts
* @description Vite configuration for Electron + React application
*
* Configures:
* - React plugin for JSX/TSX support and HMR
* - Electron main process build
* - Electron preload script build
* - Path aliases for clean imports
*
* @architecture Phase 1, Task 1.1 - Electron Application Shell
* @created 2025-11-19
* @author AI (Cline) + Human Review
*/
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import electron from 'vite-plugin-electron';
import electronRenderer from 'vite-plugin-electron-renderer';
import path from 'path';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
// React plugin for HMR and JSX transformation
react(),
// Electron main process and preload script
electron([
{
// Main process entry point
entry: 'electron/main.ts',
vite: {
build: {
outDir: 'dist-electron',
rollupOptions: {
external: ['electron', 'keytar', 'vite', 'esbuild', 'rollup', 'fsevents'],
},
},
resolve: {
// Force .ts extension resolution for src/main imports
extensions: ['.ts', '.js', '.mjs', '.json'],
alias: {
'@main': path.resolve(__dirname, './src/main'),
},
},
},
},
{
// Preload script for secure IPC
entry: 'electron/preload.ts',
vite: {
build: {
outDir: 'dist-electron',
},
},
},
]),
// Electron renderer process support
electronRenderer(),
],
// Path resolution
resolve: {
alias: {
'@': path.resolve(__dirname, './src/renderer'),
'@core': path.resolve(__dirname, './src/core'),
},
},
// Build configuration
build: {
outDir: 'dist',
emptyOutDir: true,
rollupOptions: {
input: {
main: path.resolve(__dirname, 'index.html'),
},
},
},
// Dev server configuration
server: {
port: 5173,
strictPort: true,
},
// Base URL for assets
base: './',
});