| import { defineConfig, loadEnv } from 'vite' | |
| import react from '@vitejs/plugin-react' | |
| // https://vitejs.dev/config/ | |
| export default defineConfig(({ mode }) => { | |
| // Load env file based on `mode` in the current working directory. | |
| // Set the third parameter to '' to load all env regardless of the `VITE_` prefix. | |
| const env = loadEnv(mode, process.cwd(), '') | |
| return { | |
| plugins: [react()], | |
| server: { | |
| proxy: { | |
| '/mp3s': { | |
| target: env.VITE_MP3_PROXY_TARGET || 'https://pub-047ea17229164fadb474e7389834958d.r2.dev', | |
| changeOrigin: true, | |
| rewrite: (path) => path.replace(/^\/mp3s/, '') | |
| } | |
| } | |
| } | |
| } | |
| }) |