-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
vite.config.js
75 lines (71 loc) · 1.68 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
71
72
73
74
75
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import { fileURLToPath, URL } from 'url'
import { defineConfig, loadEnv } from 'vite'
// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const config = {
plugins: [vue()],
root: 'src',
base: './',
server: {},
resolve: {
alias: {
'xmlhttprequest-ssl':
'./node_modules/engine.io-client/lib/xmlhttprequest.js',
'@': fileURLToPath(new URL('./src', import.meta.url)),
adapter: fileURLToPath(
new URL('./src/services/adapter/web.js', import.meta.url),
),
},
},
worker: {
rollupOptions: {
error: true,
output: {
entryFileNames: '[name].js',
},
},
},
build: {
commonjsOptions: { include: [] },
outDir: '../dist/web',
emptyOutDir: true,
rollupOptions: {
input: {
index: resolve(__dirname, 'src/index.html'),
editor: resolve(__dirname, 'src/editor.html'),
},
output: {
assetFileNames: '[name][extname]',
entryFileNames: '[name].js',
},
},
},
optimizeDeps: {
disabled: false,
esbuildOptions: {
keepNames: true,
},
},
keepNames: true,
esbuild: {
// needed due to cation doing a method name check
keepNames: true,
},
}
if (env.PROXY_URL) {
config.server.proxy = {
'/api': {
target: env.PROXY_URL,
changeOrigin: true,
},
'/socket.io': {
target: env.PROXY_WEBSOCKET,
ws: true,
},
}
}
return config
})