-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
66 lines (54 loc) · 1.49 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
import vue from '@vitejs/plugin-vue';
import { resolve } from 'path';
import { defineConfig } from 'vite';
import ModuleData from './module.json' with { type: 'json' };
const sourcemap = true;
const compress = false;
export default defineConfig({
root: 'src/',
base: `/${ModuleData.id}/`,
publicDir: false,
cacheDir: '../.vite-cache', // Relative from root directory
resolve: {
conditions: ['import', 'browser'],
alias: {
'~': resolve(__dirname, 'src'),
}
},
esbuild: {
target: ['es2022']
},
css: {},
define: {
'process.env': {}
},
server: {
port: 29999,
open: '/game',
proxy: {
[`^(/${ModuleData.id}/(images|assets|languages|packs|style.css))`]: 'http://localhost:30000',
[`^(?!/${ModuleData.id}/)`]: 'http://localhost:30000',
'/socket.io': { target: 'ws://localhost:30000', ws: true }
}
},
build: {
outDir: resolve(__dirname, 'dist'),
emptyOutDir: false,
sourcemap: sourcemap,
reportCompressedSize: true,
minify: compress ? 'terser' : false,
target: ['es2022'],
terserOptions: compress ? { ...terserConfig(), ecma: 2022 } : void 0,
lib: {
entry: './scripts/main.mjs',
formats: ['es'],
fileName: 'main'
}
},
optimizeDeps: {
esbuildOptions: {
target: 'es2022'
}
},
plugins: [vue()]
});