import path from 'path'; import { defineConfig, loadEnv } from 'vite'; import react from '@vitejs/plugin-react'; export default defineConfig(({ mode }) => { const env = loadEnv(mode, '.', ''); return { server: { port: 3000, host: '0.0.0.0', proxy: { '/api/fetch-data': { target: 'https://www.dropbox.com/scl/fi/b9zxn4z5i7sxwfakk5g5y/Amazon-Sell-Out-2023-2025.csv?rlkey=uoto6v0mm99py8nszy8ldtez8&st=pzn1zkrg&dl=1', changeOrigin: true, rewrite: () => '', // Replace entire path with empty string (target has full URL) followRedirects: true }, '/api/fetch-paneu-stock': { target: 'https://www.dropbox.com/scl/fi/xvsqi89mc8wk2i3jpndll/PANEU-Stock.xlsx?rlkey=djtbez2yi1sohjn203xnbjzl1&st=aogcoiw6&dl=1', changeOrigin: true, rewrite: () => '', followRedirects: true }, '/api/fetch-uk-inventory': { target: 'https://www.dropbox.com/scl/fi/an1ldjmtej7tbt6fuh2ut/UK-Inventory.xlsx?rlkey=5h8e4st885bggibujk0b1lmm8&st=7vbagnwz&dl=1', changeOrigin: true, rewrite: () => '', followRedirects: true } } }, plugins: [react()], define: { 'process.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY), 'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY) }, resolve: { alias: { '@': path.resolve(__dirname, '.'), } } }; });