32 lines
1.1 KiB
TypeScript
Executable File
32 lines
1.1 KiB
TypeScript
Executable File
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
import { defineConfig, loadEnv } from 'vite';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, '.', '');
|
|
const strapiTarget = env.VITE_STRAPI_PROXY_TARGET || 'http://localhost:1337';
|
|
return {
|
|
define: {
|
|
'process.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY),
|
|
'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY)
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, '.'),
|
|
},
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 5173,
|
|
allowedHosts: ['iieasy.ru', 'n8n.iieasy.ru'],
|
|
// Прокси к Strapi: в dev запросы на /api и /uploads идут на Strapi без CORS и без хардкода IP
|
|
proxy: {
|
|
'/api': { target: strapiTarget, changeOrigin: true },
|
|
'/uploads': { target: strapiTarget, changeOrigin: true },
|
|
},
|
|
},
|
|
};
|
|
}); |