Repository navigation
Expand file tree
/
Copy pathelectron.vite.config.ts
More file actions
53 lines (51 loc) · 1.56 KB
/
Copy pathelectron.vite.config.ts
File metadata and controls
53 lines (51 loc) · 1.56 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
import { readFileSync } from 'fs'
import { resolve } from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
const pkg = JSON.parse(readFileSync(resolve(__dirname, 'package.json'), 'utf-8')) as {
version: string
}
export default defineConfig({
main: {
plugins: [externalizeDepsPlugin()],
resolve: {
alias: { '@shared': resolve('src/shared') }
},
define: { __APP_VERSION__: JSON.stringify(pkg.version) },
build: {
rollupOptions: {
input: {
index: resolve(__dirname, 'src/main/index.ts'),
// The command line (spec 4.1). Runs as plain Node under
// ELECTRON_RUN_AS_NODE, so nothing it reaches may import electron.
cli: resolve(__dirname, 'src/cli/bootstrap.ts'),
// Cleans up after a CLI that was killed outright (src/cli/watchdog.ts).
cliWatchdog: resolve(__dirname, 'src/cli/watchdog.ts')
}
}
}
},
preload: {
plugins: [externalizeDepsPlugin()],
resolve: {
alias: { '@shared': resolve('src/shared') }
},
build: {
rollupOptions: { input: { index: resolve(__dirname, 'src/preload/index.ts') } }
}
},
renderer: {
root: 'src/renderer',
resolve: {
alias: {
'@renderer': resolve('src/renderer/src'),
'@shared': resolve('src/shared')
}
},
plugins: [react(), tailwindcss()],
build: {
rollupOptions: { input: { index: resolve(__dirname, 'src/renderer/index.html') } }
}
}
})