/
vite.config.ts
117 lines (106 loc) · 3.74 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
//----------------------------------------------------------------------------------------------------------------------
// Vite Config
//----------------------------------------------------------------------------------------------------------------------
import 'dotenv/config';
import { defineConfig } from 'vite';
// Vite Plugins
import vue from '@vitejs/plugin-vue';
import Components from 'unplugin-vue-components/vite';
import { BootstrapVueNextResolver } from 'unplugin-vue-components/resolvers';
// Interfaces
import { ServerConfig } from './src/common/interfaces/config';
// Utils
import configUtil from '@strata-js/util-config';
// ---------------------------------------------------------------------------------------------------------------------
// Configuration
// ---------------------------------------------------------------------------------------------------------------------
const env = (process.env.ENVIRONMENT ?? 'local').toLowerCase();
configUtil.load(`./config/${ env }.yml`);
const config = configUtil.get<ServerConfig>();
//----------------------------------------------------------------------------------------------------------------------
/** @type {import('vite').UserConfig} */
export default defineConfig({
root: 'src/client',
publicDir: 'assets',
plugins: [
vue({
template: {
compilerOptions: {
isCustomElement: (tag) => [
'proficiency',
'ability',
'boost',
'force',
'challenge',
'difficulty',
'setback',
'success',
'advantage',
'advantage',
'triumph',
'lightside',
'forcepoint',
'failure',
'threat',
'threat',
'despair',
'darkside'
].includes(tag)
}
}
}),
Components({
resolvers: [ BootstrapVueNextResolver() ]
})
],
// Remove charset warning caused by bootstrap
css: {
postcss: {
plugins: [
{
postcssPlugin: 'internal:charset-removal',
AtRule: {
charset: (atRule) =>
{
if(atRule.name === 'charset')
{
atRule.remove();
}
}
}
}
]
}
},
server: {
host: config.http.host,
port: config.http.port,
proxy: {
'/auth': `http://127.0.0.1:${ config.http.port - 1 }`,
'/api': `http://127.0.0.1:${ config.http.port - 1 }`,
'/version': `http://127.0.0.1:${ config.http.port - 1 }`,
'/socket.io': {
target: `http://127.0.0.1:${ config.http.port - 1 }`,
ws: true
}
},
open: false
},
define: {
__APP_VERSION__: JSON.stringify(process.env.npm_package_version)
},
build: {
outDir: '../../dist/client',
emptyOutDir: true,
cssCodeSplit: true,
chunkSizeWarningLimit: 650,
rollupOptions: {
output: {
manualChunks: {
bootstrapVueNext: [ 'bootstrap-vue-next' ]
}
}
}
}
});
//----------------------------------------------------------------------------------------------------------------------