-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.js
70 lines (68 loc) · 1.53 KB
/
vite.config.js
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
import vue from '@vitejs/plugin-vue';
import {defineConfig} from 'vitest/config';
import {quasar, transformAssetUrls} from '@quasar/vite-plugin';
import fs from 'fs';
if (process.env.CLOUD_URL == null) {
console.error('Please declare the cloud function url or the app will not function');
process.exit(1);
}
const getCert = ()=>{
try {
return fs.readFileSync('./proxy/host.crt');
} catch (ex) {
console.error('Cert not found\n', ex);
}
};
const getKey = ()=>{
try {
return fs.readFileSync('./proxy/host.key');
} catch (ex) {
console.error('Key not found\n', ex);
}
};
export default defineConfig(({mode})=>{
return {
plugins: [
vue({
template: {transformAssetUrls},
}),
quasar({
sassVariables: 'src/quasar-variables.sass',
}),
],
build: {
minify: true,
soucemap: 'inline',
},
resolve: {
extensions: ['.js', '.vue', '.mjs'],
},
server: {
host: '0.0.0.0',
port: process.env.PORT || 8000,
https: mode === 'development' && {
key: getKey(),
cert: getCert(),
},
proxy: {
'/environment': {
target: process.env.CLOUD_URL,
autoRewrite: true,
changeOrigin: true,
},
'/user': {
target: 'http://localhost:8080',
autoRewrite: true,
changeOrigin: true,
},
},
},
test: {
environment: 'happy-dom',
globals: ['vitest/globals'],
coverage: {
reporter: ['html'],
},
},
};
});