Files

23 lines
632 B
TypeScript

import tailwindcss from '@tailwindcss/vite';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
// En Docker, el contenedor de Svelte no puede resolver "localhost" hacia nginx.
// docker-compose define API_PROXY_TARGET=http://nginx:80.
const nodeProcess = globalThis as {
process?: { env?: Record<string, string | undefined> };
};
const apiProxyTarget = nodeProcess.process?.env?.API_PROXY_TARGET || 'http://localhost:80';
export default defineConfig({
plugins: [tailwindcss(), sveltekit()],
server: {
proxy: {
'/api': {
target: apiProxyTarget,
changeOrigin: true
}
}
}
});