/
vite.config.ts
59 lines (58 loc) · 1.5 KB
/
vite.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
57
58
59
import { join } from 'path';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { visualizer } from 'rollup-plugin-visualizer';
import renderer from 'vite-plugin-electron-renderer';
import checker from 'vite-plugin-checker';
import { svgInline } from './build/svg-inline';
import { svgrPlugin } from './build/vite-svgr-plugin';
// https://vitejs.dev/config/
export default defineConfig({
server: {
host: '0.0.0.0',
port: Number(process.env.PORT || 31521),
},
publicDir: join(__dirname, 'public'),
resolve: {
alias: {
'~': join(__dirname, 'src'),
},
},
define: {
'process.env.BUILD_ENV': JSON.stringify(process.env.BUILD_ENV),
},
// base: prod ? './' : '/',
build: {
outDir: 'src/dist',
},
plugins: [
checker({
typescript: true,
eslint: {
lintCommand: 'eslint --ext ".js,.jsx,.ts,.tsx" ./src',
dev: {
// cwd provided by vite cannot be handled by eslint with forward slash on windows
// https://github.com/eslint/eslint/issues/17042
overrideConfig: {
cwd: __dirname,
},
},
},
overlay: false,
}),
renderer({
resolve: {
'electron-store': { type: 'cjs' },
'electron-log': { type: 'cjs' },
'tar-stream': { type: 'cjs' },
},
}),
react(),
svgInline(),
svgrPlugin(),
!!process.env.analyze && visualizer({
filename: join(__dirname, 'dist/stats.html'),
open: true,
}),
],
});