Files
kittyFE/kittyurl-frontend/vite.config.ts
Pc 5dd751600c
All checks were successful
Update changelog / changelog (push) Successful in 28s
test:v2
2026-01-04 16:15:08 +01:00

54 lines
1.5 KiB
TypeScript

import { defineConfig, loadEnv, type PluginOption } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import path from 'path'
import { fileURLToPath } from 'url'
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default defineConfig(({ mode }) => {
const envDirectory = path.resolve(__dirname, '..');
const env = loadEnv(mode, envDirectory, '');
const backendTarget = env.VITE_API_TARGET;
return {
envDir: envDirectory,
plugins: [
react() as PluginOption,
tailwindcss() as PluginOption,
],
server: {
port: 6568,
host: true, // Pozwala na dostęp przez IP w sieci lokalnej
// Jeśli testujesz subdomeny lokalnie (np. app.local.ktty.is), dodaj to:
allowedHosts: [
'.ktty.is',
'localhost',
'127.0.0.1',
],
// vite.config.ts
proxy: {
'/api': {
target: backendTarget,
changeOrigin: true,
secure: false,
cookieDomainRewrite: {
"*": ""
},
},
},
},
preview: {
port: 6568,
allowedHosts: true,
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
}
})