-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
70 lines (68 loc) · 1.86 KB
/
Copy pathvite.config.ts
File metadata and controls
70 lines (68 loc) · 1.86 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
import { defineConfig } from 'vite';
import electron from 'vite-plugin-electron';
import renderer from 'vite-plugin-electron-renderer';
import { resolve } from 'path';
export default defineConfig(({ command, mode }) => {
const isElectron = process.env.ELECTRON === 'true';
return {
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
'@shared': resolve(__dirname, 'src/shared'),
'@renderer': resolve(__dirname, 'src/renderer'),
'@main': resolve(__dirname, 'src/main'),
},
},
build: {
outDir: 'dist/renderer',
emptyOutDir: false,
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
},
output: {
manualChunks(id) {
if (!id.includes('node_modules')) return;
if (id.includes('pixi.js')) return 'pixi';
if (id.includes('pako')) return 'compression-vendor';
if (id.includes('howler') || id.includes('@pixi/sound') || id.includes('chiptune3') || id.includes('butterchurn')) return 'audio-vendor';
return 'vendor';
},
},
},
},
plugins: isElectron
? [
electron([
{
entry: 'src/main/index.ts',
vite: {
build: {
outDir: 'dist/main',
rollupOptions: {
external: ['electron'],
},
},
},
},
{
entry: 'src/main/preload.ts',
onstart(options) {
options.reload();
},
vite: {
build: {
outDir: 'dist/main',
},
},
},
]),
renderer(),
]
: [],
server: {
port: 3000,
},
publicDir: 'data',
};
});