-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
134 lines (133 loc) · 3.77 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/// <reference types="vitest" />
import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import vuetify from 'vite-plugin-vuetify';
import basicSsl from '@vitejs/plugin-basic-ssl';
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
export default defineConfig({
build: {
// Disable inlining of assets
assetsInlineLimit: 0,
},
define: {
/* disable hydration mismatch details in production build */
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'false',
},
plugins: [
VueI18nPlugin({
/* we have to enable jit compilation to use i18n interpolation without violating the CSP
https://github.com/intlify/vue-i18n-next/issues/1059#issuecomment-1646097462 */
jitCompilation: true,
}),
vue(),
vuetify({
styles: {
configFile: 'src/styles/settings.scss',
},
}),
basicSsl(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
server: {
port: 8099,
proxy: {
'/api': {
target: 'http://localhost:9090/',
changeOrigin: true,
secure: false,
xfwd: true,
},
},
},
test: {
server: {
deps: {
inline: ['vuetify'],
},
},
environment: 'jsdom',
globals: true,
include: ['src/**/*.spec.ts'],
setupFiles: 'vitest.setup.ts',
coverage: {
provider: 'istanbul',
reporter: ['text', 'lcov'],
include: ['src/**'],
exclude: [
'src/api-client/**',
'src/plugins/**',
'src/services/**',
'src/specs/**',
'src/router/**',
'src/**/**.spec.ts',
'src/App.vue',
'src/main.ts',
],
thresholds: {
// TODO: activate thresholds for commented dirs
// 'src/**/**.*': {
// statements: 100,
// functions: 100,
// branches: 100,
// lines: 100,
// },
// TODO: reset components threshold to 80 when thresholds can be reached
'src/components/**/**.vue': {
statements: 75,
functions: 75,
branches: 75,
lines: 75,
},
// 'src/layouts/**/**.vue': {
// statements: 80,
// functions: 80,
// branches: 80,
// lines: 80,
// },
'src/stores/**/**.ts': {
statements: 100,
functions: 100,
// TODO: reset branches threshold to 100 when store error handler is implemented
// delete stores dir block from thresholds when first block is uncommented
branches: 80,
lines: 100,
},
// 'src/utils/**/**.ts': {
// statements: 80,
// functions: 80,
// branches: 80,
// lines: 80,
// },
'src/views/**/**.vue': {
// TODO: reset thresholds to 80 and write tests for views
statements: 60,
functions: 50,
branches: 45,
lines: 60,
},
},
},
},
preview: {
port: 8099,
proxy: {
'/api': {
target: 'http://localhost:9090/',
changeOrigin: true,
secure: false,
xfwd: true,
},
},
headers: {
// Only for local development productive CSP is defined in nginx-vue.conf. Nonce is static, not safe for production.
// This does not apply for 'npm run dev', but only to 'npm run preview'. CSP can not be applied for 'npm run dev', because it is missing the build step and thus has many inline JS/CSS
'Content-Security-Policy':
"default-src 'self'; script-src 'self' 'nonce-CSPN0NCEPLAC3H0LDER'; style-src 'self' 'nonce-CSPN0NCEPLAC3H0LDER'; font-src 'self'; img-src 'self' data:; frame-src 'self'; base-uri 'self'; object-src 'none';",
},
},
});