Spaces:
Sleeping
Sleeping
| /// <reference types="vitest" /> | |
| import { defineConfig } from 'vite' | |
| import react from '@vitejs/plugin-react' | |
| // https://vitejs.dev/config/ | |
| export default defineConfig({ | |
| plugins: [react()], | |
| test: { | |
| globals: true, | |
| environment: 'jsdom', | |
| setupFiles: './src/setupTests.js', | |
| }, | |
| server: { | |
| host: true, | |
| port: 5173, | |
| watch: { | |
| usePolling: true | |
| }, | |
| proxy: { | |
| '/api/hf-inference': { | |
| target: 'https://router.huggingface.co', | |
| changeOrigin: true, | |
| rewrite: (path) => path.replace(/^\/api\/hf-inference/, ''), | |
| configure: (proxy) => { | |
| const token = process.env.VITE_HF_TOKEN; | |
| if (token) { | |
| proxy.on('proxyReq', (proxyReq) => { | |
| proxyReq.setHeader('Authorization', `Bearer ${token}`); | |
| }); | |
| } | |
| }, | |
| }, | |
| }, | |
| }, | |
| }) | |