-
Notifications
You must be signed in to change notification settings - Fork 224
/
vite.config.mjs
98 lines (93 loc) · 2.4 KB
/
vite.config.mjs
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
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { ViteEjsPlugin } from 'vite-plugin-ejs'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import rollupNodePolyFill from 'rollup-plugin-polyfill-node'
import { resolve } from 'path'
import istanbul from 'vite-plugin-istanbul'
import availablePortals from './portals/availablePortals.json'
import { getApplicationConfig } from './sharedUtils/config'
const {
analytics,
defaultPortal,
env,
feedbackApp
} = getApplicationConfig()
const { [defaultPortal]: portalConfig } = availablePortals
const { ui } = portalConfig
const { showTophat } = ui
export default defineConfig({
server: {
host: true,
port: 8080,
watch: {
ignored: [
'**/coverage/**',
'**/playwright-report/**',
'**/tests/**',
'**/test-results/**'
]
}
},
plugins: [
ViteEjsPlugin({
env,
environment: process.env.NODE_ENV,
feedbackApp,
gaPropertyId: analytics.localIdentifier.propertyId,
gtmPropertyId: analytics.gtmPropertyId,
includeDevGoogleAnalytics: analytics.localIdentifier.enabled,
showTophat
}),
react(),
nodePolyfills(),
istanbul({
include: 'static/src/*',
exclude: ['node_modules', 'test/'],
extension: ['.js', '.jsx'],
requireEnv: true,
forceBuildInstrument: process.env.VITE_COVERAGE === 'true'
})
],
css: {
devSourcemap: true,
preprocessorOptions: {
scss: {
additionalData: '@import "static/src/css/vendor/bootstrap/vars"; @import "static/src/css/utils/utils";'
}
}
},
resolve: {
alias: {
'~bootstrap': resolve(__dirname, 'node_modules/bootstrap'),
'~Fonts': resolve(__dirname, 'static/src/assets/fonts'),
'~Images': resolve(__dirname, 'static/src/assets/images')
}
},
build: {
outDir: 'static/dist',
rollupOptions: {
plugins: [
rollupNodePolyFill()
]
}
},
// TODO: vitest is currently blocked by enzyme removal ticket EDSC-4201
test: {
globals: true,
environment: 'jsdom',
setupFiles: 'test-setup.js',
clearMocks: true,
coverage: {
enabled: true,
include: [
'serverless/src/**/*.js',
'static/src/**/*.js',
'static/src/**/*.jsx'
],
provider: 'istanbul',
reporter: ['text', 'lcov', 'clover', 'json'],
reportOnFailure: true
}
}
})