-
-
Notifications
You must be signed in to change notification settings - Fork 274
/
vite.config.ts
80 lines (78 loc) · 1.97 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
import createVuePlugin from '@vitejs/plugin-vue';
import { BootstrapVueNextResolver } from 'bootstrap-vue-next';
import { execSync } from 'child_process';
import { resolve } from 'path';
import AutoImport from 'unplugin-auto-import/vite';
import IconsResolve from 'unplugin-icons/resolver';
import Icons from 'unplugin-icons/vite';
import Components from 'unplugin-vue-components/vite';
import { defineConfig } from 'vite';
let commitHash: string = 'unknown';
try {
commitHash = execSync('git rev-parse --short HEAD').toString();
} catch (error) {
console.error('Failed to get commit hash. Running in this mode will not be supported.');
}
// https://vitejs.dev/config/
export default defineConfig({
define: {
__COMMIT_HASH__: JSON.stringify(commitHash),
},
plugins: [
createVuePlugin({
script: {
defineModel: true,
},
}),
Components({
resolvers: [IconsResolve(), BootstrapVueNextResolver()],
dts: 'src/components.d.ts',
}),
Icons({
compiler: 'vue3',
}),
AutoImport({
imports: ['vue', 'vue-router', '@vueuse/core', 'pinia'],
dts: 'src/auto-imports.d.ts',
dirs: ['src/composables', 'src/stores', 'src/utils/**'],
vueTemplate: true,
}),
],
resolve: {
dedupe: ['vue'],
alias: {
'@': resolve(__dirname, 'src'),
},
},
build: {
chunkSizeWarningLimit: 700, // Default is 500
sourcemap: true,
},
css: {
preprocessorOptions: {
scss: {
additionalData: '@import "@/styles/_variables.scss";',
},
},
},
server: {
proxy: {
'/api': {
target: 'http://127.0.0.1:8080',
changeOrigin: true,
},
},
host: '127.0.0.1',
port: 3000,
},
test: {
environment: 'happy-dom',
exclude: [
'**/node_modules/**',
'**/dist/**',
'**/e2e/**',
'**/.{idea,git,cache,output,temp}/**',
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
],
},
});