diff --git a/docker-compose.yml b/docker-compose.yml index 46aa30c..e43df15 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,6 +18,8 @@ services: context: ./frontend ports: - "5173:5173" + env_file: + - ./.env volumes: - ./frontend:/app - /app/node_modules # Prevents host node_modules from overwriting container diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 8b0f57b..28cb896 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -1,7 +1,17 @@ -import { defineConfig } from 'vite' +import { defineConfig, loadEnv } from 'vite' import react from '@vitejs/plugin-react' // https://vite.dev/config/ -export default defineConfig({ - plugins: [react()], +export default defineConfig(({ mode }) => { + const env = loadEnv(mode, process.cwd(), ''); + + const allowedHosts = env.VITE_ALLOWED_HOSTS?.split(',') || []; + + return { + plugins: [react()], + server: { + host: true, // Allow external access + allowedHosts: allowedHosts, + } + } })