forked from oldj/SwitchHosts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.main.config.ts
56 lines (55 loc) · 1.6 KB
/
vite.main.config.ts
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
import * as path from 'path'
import { defineConfig, normalizePath } from 'vite'
import { viteStaticCopy } from 'vite-plugin-static-copy'
import tsconfigPaths from 'vite-tsconfig-paths'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
tsconfigPaths(),
viteStaticCopy({
targets: [
{
src: normalizePath(path.resolve(__dirname, 'assets', '*.png')),
dest: 'assets',
},
{
src: normalizePath(path.resolve(__dirname, 'src', 'assets', '*.png')),
dest: 'assets',
},
],
}),
],
// root: path.join(__dirname, 'src', 'main'),
base: './',
build: {
rollupOptions: {
input: {
main: path.join(__dirname, 'src', 'main', 'main.ts'),
preload: path.join(__dirname, 'src', 'main', 'preload.ts'),
// renderer: path.join(__dirname, 'src', 'renderer', 'index.html'),
},
},
lib: {
entry: path.join(__dirname, 'src', 'main', 'main.ts'),
name: 'main',
formats: ['cjs'],
// fileName: (format) => `main.${format}.js`,
fileName: (format) => `main.js`,
},
outDir: path.join(__dirname, 'build'),
minify: true,
ssr: true,
emptyOutDir: false,
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
'@root': path.resolve(__dirname),
'@assets': path.resolve(__dirname, 'assets'),
'@src': path.resolve(__dirname, 'src'),
'@common': path.resolve(__dirname, 'src', 'common'),
'@main': path.resolve(__dirname, 'src', 'main'),
'@renderer': path.resolve(__dirname, 'src', 'renderer'),
},
},
})