-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathvite.config.mts
More file actions
77 lines (74 loc) · 1.69 KB
/
vite.config.mts
File metadata and controls
77 lines (74 loc) · 1.69 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
import dns from 'dns';
import path from 'path';
import basicSsl from '@vitejs/plugin-basic-ssl';
import react from '@vitejs/plugin-react-swc';
import { defineConfig } from 'vite';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
import svgr from 'vite-plugin-svgr';
import tsconfigPaths from 'vite-tsconfig-paths';
// https://vitejs.dev/config/
(dns as any).setDefaultResultOrder('verbatim');
export default () => {
const shouldUseTSL =
process.env.VITE_APP_USE_HTTPS?.toLowerCase() !== 'false';
return defineConfig({
plugins: [
react(),
tsconfigPaths(),
nodePolyfills({
globals: { Buffer: true, global: true, process: true }
}),
svgr({
include: '**/*.svg',
svgrOptions: {
exportType: 'default'
}
}),
...(shouldUseTSL ? [basicSsl()] : [])
],
resolve: {
alias: {
'~bootstrap': path.resolve(__dirname, 'node_modules/bootstrap')
}
},
css: {
preprocessorOptions: {
scss: {
quietDeps: true,
silenceDeprecations: [
'legacy-js-api',
'import',
'global-builtin',
'mixed-decls',
'abs-percent',
'color-functions'
]
}
}
},
build: {
outDir: 'build',
cssMinify: true,
minify: true
},
server: {
port: 3002,
strictPort: true,
https: shouldUseTSL,
host: true,
hmr: {
overlay: false
},
watch: {
usePolling: false,
useFsEvents: false
}
},
preview: {
port: 3002,
strictPort: true,
https: shouldUseTSL,
host: 'localhost'
}
});
};