forked from VueTorrent/VueTorrent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
78 lines (76 loc) · 2.11 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
/// <reference types="vitest" />
import vue from '@vitejs/plugin-vue'
import { resolve } from 'node:path'
import { fileURLToPath, URL } from 'node:url'
import { defineConfig, loadEnv } from 'vite'
import topLevelAwait from 'vite-plugin-top-level-await'
import vuetify from 'vite-plugin-vuetify'
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd())
const qBittorrentHost = env.VITE_QBITTORRENT_TARGET ?? 'http://127.0.0.1'
const qBittorrentPort = env.VITE_QBITTORRENT_PORT ?? '8080'
const backendHost = env.VITE_BACKEND_HOST ?? 'http://127.0.0.1'
const backendPort = env.VITE_BACKEND_PORT ?? '3000'
return {
base: './',
build: {
target: 'esnext',
outDir: mode === 'demo' ? './vuetorrent-demo' : './vuetorrent/public',
rollupOptions: {
output: {
manualChunks: {
// apexcharts: ['apexcharts', 'vue3-apexcharts'],
vue: ['vue', 'vue-router', 'vue-i18n', 'vue3-toastify', 'vuedraggable', 'pinia', 'pinia-persistence-plugin'],
vuetify: ['vuetify']
}
}
}
},
define: {
'import.meta.env.VITE_PACKAGE_VERSION': JSON.stringify(process.env.npm_package_version),
'process.env': {}
},
plugins: [
vue(),
vuetify(),
topLevelAwait({
promiseExportName: '__tla',
promiseImportName: i => `__tla_${i}`
})
],
publicDir: './public',
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server: {
host: '0.0.0.0',
port: 3000,
proxy: {
'/api': {
secure: false,
target: `${qBittorrentHost}:${qBittorrentPort}`
},
'/backend': {
secure: false,
target: `${backendHost}:${backendPort}`
}
}
},
test: {
environment: 'jsdom',
globals: true,
setupFiles: [resolve(__dirname, 'tests/setup.ts')],
coverage: {
reportsDirectory: './tests/unit/coverage'
},
server: {
deps: {
inline: ['vuetify']
}
}
}
}
})