-
Notifications
You must be signed in to change notification settings - Fork 17
/
vite.config.mjs
62 lines (60 loc) · 1.69 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
import { BootstrapVueNextResolver } from 'unplugin-vue-components/resolvers'
import { defineConfig, loadEnv } from 'vite'
import { resolve } from 'path'
import * as childProcess from 'child_process'
import Components from 'unplugin-vue-components/vite'
import vue from '@vitejs/plugin-vue'
export default ({ mode }) => {
const VITE_GIT_HASH = childProcess.execSync('git rev-parse HEAD').toString()
process.env = Object.assign(process.env, { VITE_GIT_HASH, ...loadEnv(mode, process.cwd(), '') })
return defineConfig({
plugins: [
vue(),
Components({
resolvers: [BootstrapVueNextResolver()]
})
],
test: {
globals: true,
reporters: 'basic',
environment: 'jsdom',
setupFiles: [resolve(__dirname, 'tests/unit/setup.js')]
},
resolve: {
dedupe: ['vue'],
extensions: ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json', '.vue'],
alias: {
path: 'path-browserify',
vue: resolve(__dirname, 'node_modules/vue/dist/vue.esm-bundler.js'),
'@': resolve(__dirname, './src'),
'~node_modules': resolve('node_modules'),
'~mixins': resolve(__dirname, './src/mixins'),
'~tests': resolve(__dirname, 'tests')
}
},
css: {
preprocessorOptions: {
scss: {
additionalData: `
@use 'sass:math';
@import "@/utils/settings.scss";
`
}
}
},
server: {
port: 9009,
host: '0.0.0.0',
watch: {
usePolling: true
},
proxy: {
'^/(version|settings|me|api).?': {
target: process.env.VITE_DEV_PROXY,
changeOrigin: true,
secure: false
}
}
}
})
}