-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
90 lines (86 loc) · 2.37 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'
import legacy from '@vitejs/plugin-legacy'
import { visualizer } from 'rollup-plugin-visualizer';
import eslint from 'vite-plugin-eslint'
import { fileURLToPath } from 'url'
import * as path from 'path'
import * as fs from 'fs';
export default defineConfig(({ command, mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const enableHttps = fs.existsSync('/certs/localhost.key');
return {
plugins: [
react(),
eslint(),
visualizer(),
legacy({
targets: ['defaults', 'not IE 11']
})
],
base: command === 'serve' ? '/dist/' : '',
define: {
__DEV__: mode === 'development',
__APP_INSIGHTS__: JSON.stringify(env.APP_INSIGHTS_KEY),
},
esbuild: {
drop: ['console', 'debugger'],
},
resolve: {
alias: {
'hooks': path.resolve(__dirname, 'src/hooks'),
'services': path.resolve(__dirname, 'src/services'),
'components': path.resolve(__dirname, 'src/components'),
'test': path.resolve(__dirname, 'src/test'),
},
},
css: {
modules: {
localsConvention: 'camelCaseOnly',
}
},
build: {
rollupOptions: {
input: {
Settings: fileURLToPath(new URL('./Settings.html', import.meta.url)),
FormPage: fileURLToPath(new URL('./FormPage.html', import.meta.url)),
FormGroup: fileURLToPath(new URL('./FormGroup.html', import.meta.url)),
AddDocumentDialog: fileURLToPath(new URL('./AddDocumentDialog.html', import.meta.url)),
}
}
},
server: {
port: 8080,
strictPort: true,
https: enableHttps ? {
key: fs.readFileSync('/certs/localhost.key'),
cert: fs.readFileSync('/certs/localhost.pem'),
requestCert: false,
} : undefined,
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: './src/test/setup.ts',
reporters: ['default', 'junit'],
outputFile: './test-results.xml',
deps: {
inline: [
'azure-devops-ui',
]
},
coverage: {
//reportDir: './coverage',
reporter: 'cobertura',
threshold: {
global: {
statements: 100,
branches: 100,
functions: 100,
lines: 100,
}
}
}
},
}
})