From 1e973bf81c5880000941c8f4556dca4c6ca8d824 Mon Sep 17 00:00:00 2001 From: Alexis Date: Wed, 13 May 2026 11:30:12 +0200 Subject: [PATCH] Update Vite configuration to use base path from environment and simplify proxy settings; adjust main entry point for BrowserRouter basename. --- frontend/src/main.jsx | 19 +++++++++---------- frontend/vite.config.js | 20 +++++--------------- 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/frontend/src/main.jsx b/frontend/src/main.jsx index d9e87bc..be0f423 100644 --- a/frontend/src/main.jsx +++ b/frontend/src/main.jsx @@ -1,14 +1,13 @@ -import { StrictMode } from "react"; -import { createRoot } from "react-dom/client"; -import { BrowserRouter } from "react-router-dom"; +import { StrictMode } from 'react' +import { createRoot } from 'react-dom/client' +import { BrowserRouter } from 'react-router-dom' +import App from './App.jsx' +import './index.css' -import "./index.css"; -import App from "./App.jsx"; - -createRoot(document.getElementById("root")).render( +createRoot(document.getElementById('root')).render( - + - , -); + +) \ No newline at end of file diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 8183396..ec5c921 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -2,32 +2,22 @@ import { defineConfig, loadEnv } from 'vite' import react from '@vitejs/plugin-react' import tailwindcss from '@tailwindcss/vite' -// https://vite.dev/config/ export default defineConfig(({ mode }) => { const env = loadEnv(mode, import.meta.dirname, '') const proxyTarget = env.VITE_API_PROXY_TARGET || 'http://localhost:8000' + const base = env.VITE_BASE_PATH || '/' return { + base, plugins: [react(), tailwindcss()], server: { host: true, - // Needed for HTTPS tunnels like ngrok during OAuth callback flows. - // We allow all hosts in dev to avoid host-blocking when ngrok URL rotates. allowedHosts: true, port: 5173, proxy: { - // El backend agrupa todo bajo /api (researchers, export, …). - // Con un único prefijo evitamos tener que mantener una entrada - // por router cada vez que se añada un endpoint nuevo. - '/api': { - target: proxyTarget, - changeOrigin: true, - }, - '/health': { - target: proxyTarget, - changeOrigin: true, - }, + '/api': { target: proxyTarget, changeOrigin: true }, + '/health': { target: proxyTarget, changeOrigin: true }, }, }, } -}) +}) \ No newline at end of file