-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
131 lines (126 loc) · 3.72 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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue2'
import { VitePWA } from 'vite-plugin-pwa'
import Components from 'unplugin-vue-components/vite'
import { VuetifyResolver } from 'unplugin-vue-components/resolvers'
import { fileURLToPath, URL } from 'node:url'
const version = process.env.NODE_ENV === 'production' ? process.env.npm_package_version : JSON.stringify(process.env.npm_package_version)
export default defineConfig(({ command, mode }) => {
const theEnv = loadEnv(mode, process.cwd())
const qBittorrentPort = theEnv.VITE_QBITTORRENT_PORT ?? 8080
const proxyTarget = theEnv.VITE_QBITTORRENT_TARGET ?? 'http://127.0.0.1'
return {
base: './',
build: {
target: 'esnext',
rollupOptions: {
output: {
manualChunks: {
vue: ['vue', 'vue-router', 'vue-router/composables', 'vuex', 'vuex-persist']
}
}
},
outDir: './vuetorrent/public'
},
define: {
'import.meta.env.VITE_PACKAGE_VERSION': version,
'process.env': {}
},
plugins: [
vue(),
Components({
dts: false,
directives: false,
resolvers: [VuetifyResolver()],
types: [
{
from: 'vue-router',
names: ['RouterLink', 'RouterView']
}
]
}),
VitePWA({
includeAssets: [
'favicon.ico',
'robots.txt',
'./icons/android-chrome-192x192.png',
'./icons/android-chrome-512x512.png',
'./icons/android-chrome-maskable-192x192.png',
'./icons/android-chrome-maskable-512x512.png',
'./icons/apple-touch-icon.png',
'./icons/safari-pinned-tab.svg',
'./icons/msapplication-icon-144x144.png'
],
manifest: {
name: 'VueTorrent',
short_name: 'VueTorrent',
theme_color: '#597566',
start_url: '.',
background_color: '#000',
icons: [
{
src: './icons/android-chrome-192x192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: './icons/android-chrome-512x512.png',
sizes: '512x512',
type: 'image/png'
},
{
src: './icons/android-chrome-maskable-192x192.png',
sizes: '192x192',
type: 'image/png',
purpose: 'maskable'
},
{
src: './icons/android-chrome-maskable-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable'
},
{
src: './icons/apple-touch-icon.png',
sizes: '180x180',
type: 'image/png'
},
{
src: './icons/safari-pinned-tab.svg',
sizes: '683x683',
type: 'image/svg+xml'
},
{
src: './icons/msapplication-icon-144x144.png',
sizes: '144x144',
type: 'image/png'
}
]
},
// Other options
registerType: 'autoUpdate',
base: './',
useCredentials: true,
workbox: {
skipWaiting: true,
globPatterns: ['**/*.{js,css,html,ico,png,svg}']
}
})
],
publicDir: './public',
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'~': fileURLToPath(new URL('./node_modules', import.meta.url))
},
extensions: ['.js', '.json', '.jsx', '.ts', '.tsx', '.vue']
},
server: {
host: '0.0.0.0',
port: 3000,
proxy: {
'/api': `${proxyTarget}:${qBittorrentPort}`
}
}
}
})