mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2024-11-24 18:36:14 +03:00
125 lines
3.3 KiB
JavaScript
125 lines
3.3 KiB
JavaScript
import { resolve, dirname } from 'path'
|
|
import { defineConfig } 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)
|
|
|
|
const qBittorrentPort = process.env['QBITTORRENT_PORT'] ?? 8080
|
|
const proxyTarget = process.env['QBITTORRENT_TARGET'] ?? 'http://127.0.0.1'
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
'~': fileURLToPath(new URL('./node_modules', import.meta.url))
|
|
}
|
|
},
|
|
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}']
|
|
}
|
|
})
|
|
],
|
|
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
|
|
},
|
|
base: './',
|
|
publicDir: './public',
|
|
server: {
|
|
proxy: {
|
|
'/api': `${proxyTarget}:${qBittorrentPort}`
|
|
}
|
|
}
|
|
})
|