Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/FoxxMD/multi-scrobbler. Scrobble plays from multiple sources to multiple clients docs.multi-scrobbler.app
deezer docker jellyfin koito lastfm listenbrainz maloja mopidy mpris music music-assistant plex scrobble self-hosted spotify subsonic tautulli youtube-music
Something went wrong. Try again.
multi-scrobbler vite.config.ts
2.7 kB · 84 lines
TypeScript
at debugStartup
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485import react,{ reactCompilerPreset } from '@vitejs/plugin-react';import babel from '@rolldown/plugin-babel';import normalizeUrl from "normalize-url";import { defineConfig } from 'vite';import tailwindcss from '@tailwindcss/vite'import { dirname, resolve } from 'node:path'
const QUOTES_UNWRAP_REGEX: RegExp = new RegExp(/^"(.*)"$/);export const generateBaseURL = (userUrl: string | undefined): URL => { let cleanUserUrl = userUrl.trim(); if (QUOTES_UNWRAP_REGEX.test(cleanUserUrl)) { const results = cleanUserUrl.match(QUOTES_UNWRAP_REGEX); cleanUserUrl = results[1]; } const base = normalizeUrl(cleanUserUrl, { removeSingleSlash: true }); const u = new URL(base); if (u.port === '') { if (u.protocol === 'https:') { u.port = '443'; } else if (userUrl.includes(`${u.hostname}:80`)) { u.port = '80'; } } return u;}
export default defineConfig(() => { let baseUrlStr = '/'; if (process.env.BASE_URL !== undefined && process.env.BASE_URL !== '') { const baseUrl = generateBaseURL(process.env.BASE_URL); if (baseUrl.pathname !== '/') { baseUrlStr = baseUrl.toString(); } } console.debug(`[VITE] BASE_URL ENV: ${process.env.BASE_URL} | Base Url String: ${baseUrlStr}`); return { server: { allowedHosts: (true as true), watch: { ignored: ['**/config/**'] } }, esbuild: { minifyIdentifiers: false }, base: baseUrlStr, plugins: [ react(), babel({ presets: [reactCompilerPreset()] }), tailwindcss(), ], build: { sourcemap: true, cssCodeSplit: true, rolldownOptions: { input: { main: resolve(import.meta.dirname, 'index.html'), next: resolve(import.meta.dirname, 'next/index.html'), }, keepNames: true, sourcemap: true }, }, define: { "__USE_HASH_ROUTER__": JSON.stringify((process.env.USE_HASH_ROUTER ?? false)) }, css: { preprocessorOptions: { scss: { api: 'modern-compiler' // or "modern" } } }, // for some reason vite is pulling in discord.js to dependencies when it doesn't need to optimizeDeps: { exclude: ['discord.js', 'zlib-sync', 'bufferutil', 'utf-8-validate', '@discordjs/opus'], }, ssr: { external: ['discord.js'], }, };});