25 lines
672 B
JavaScript
25 lines
672 B
JavaScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react(), tailwindcss()],
|
|
server: {
|
|
proxy: {
|
|
'/api/anthropic': {
|
|
target: 'https://api.anthropic.com',
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/api\/anthropic/, ''),
|
|
configure: (proxy) => {
|
|
proxy.on('proxyReq', (proxyReq) => {
|
|
if (process.env.ANTHROPIC_API_KEY) {
|
|
proxyReq.setHeader('x-api-key', process.env.ANTHROPIC_API_KEY);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|