Files
CrazeAnalytix/vite.config.ts
T

64 lines
2.4 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: {
'process.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY || env.API_KEY || ""),
'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY || env.API_KEY || ""),
'import.meta.env.VITE_GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY || env.API_KEY || ""),
'import.meta.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY || env.API_KEY || "")
},
resolve: {
alias: {
'@': path.resolve(__dirname, '.'),
}
}
};
});