-
Notifications
You must be signed in to change notification settings - Fork 134
/
Copy pathvite.config.ts
51 lines (49 loc) · 1.14 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
import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react';
import { VitePWA } from 'vite-plugin-pwa';
import { execSync } from 'node:child_process';
import path from 'path';
let hash = '';
try {
hash = execSync('git rev-parse --short HEAD').toString().trim();
} catch (error) {
hash = 'DEV';
}
export default defineConfig({
plugins: [react(),
VitePWA({
registerType: 'autoUpdate',
strategies: 'generateSW',
devOptions: {
enabled: true
},
workbox: {
cleanupOutdatedCaches: true,
sourcemap: true
}
})
],
define: {
'process.env.COMMIT_HASH': JSON.stringify(hash),
},
resolve: {
alias: {
'@app': path.resolve(__dirname, './src'),
'@pages': path.resolve(__dirname, './src/pages'),
'@components': path.resolve(__dirname, './src/components'),
'@core': path.resolve(__dirname, './src/core'),
'@layouts': path.resolve(__dirname, './src/layouts'),
},
},
server: {
port: 3000
},
optimizeDeps: {
exclude: ['react-scan']
},
test: {
environment: 'happy-dom',
globals: true,
include: ['**/*.{test,spec}.{ts,tsx}'],
}
});