Files
CrazeAnalytix/vite.config.ts
Christian Vidal WolfandClaude Opus 4.6 2bce0a839b feat: add Supabase vendor data integration (BSR, ratings, buy box)
- Create vendor_daily_data table schema and Supabase client service
- Add upload API route for Vendor Central CSV parsing and upsert
- Add VendorDataView with BSR trend, ratings, and buy box charts
- Integrate new Vendor tab into app navigation (desktop + mobile)
- Add vendor CSV upload card to FileUpload modal

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:19:25 +01:00

73 lines
2.7 KiB
TypeScript

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
},
'/api/fetch-buybox': {
target: 'https://www.dropbox.com/scl/fi/dooz56abib51ifaf42cpx/Buy_Box_tracker.xlsx?rlkey=2sx85bne42fju3d8vekfygzau&dl=1',
changeOrigin: true,
rewrite: () => '',
followRedirects: true
},
'/api/fetch-ads': {
target: 'https://www.dropbox.com/scl/fi/wng8tep7awhvzd65amwad/Ads-Weekly.xlsx?rlkey=kcmoq8dxgibsb2eb8zz47xvyo&dl=1',
changeOrigin: true,
rewrite: () => '',
followRedirects: true
},
'/api/fetch-stock': {
target: 'https://www.dropbox.com/scl/fi/jaxc1y01ot7wj4ksswaoe/Item-Availability.xlsx?rlkey=v428jlri5jf1z5ggiebze7ovo&dl=1',
changeOrigin: true,
rewrite: () => '',
followRedirects: true
}
}
},
plugins: [react()],
define: {
// loadEnv reads .env files; process.env has Vercel/system env vars at build time
'process.env.API_KEY': JSON.stringify(
env.GEMINI_API_KEY || env.API_KEY || process.env.GEMINI_API_KEY || process.env.API_KEY || ""
),
'process.env.GEMINI_API_KEY': JSON.stringify(
env.GEMINI_API_KEY || env.API_KEY || process.env.GEMINI_API_KEY || process.env.API_KEY || ""
),
'process.env.SUPABASE_URL': JSON.stringify(
env.SUPABASE_URL || process.env.SUPABASE_URL || ""
),
'process.env.SUPABASE_ANON_KEY': JSON.stringify(
env.SUPABASE_ANON_KEY || process.env.SUPABASE_ANON_KEY || ""
),
},
resolve: {
alias: {
'@': path.resolve(__dirname, '.'),
}
}
};
});