34 lines
1013 B
TypeScript
34 lines
1013 B
TypeScript
import path from "path";
|
|
import { fileURLToPath } from "url";
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import { defineConfig } from "vite";
|
|
import { viteSingleFile } from "vite-plugin-singlefile";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react(), tailwindcss(), viteSingleFile()],
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "src"),
|
|
},
|
|
},
|
|
// dev-режим: /api уходит в локально запущенную CRM (python crm/server.py),
|
|
// /media — загруженные владельцем фото позиций
|
|
server: {
|
|
proxy: {
|
|
"/api": {
|
|
target: process.env.CRM_API_URL || "http://127.0.0.1:47613",
|
|
changeOrigin: true,
|
|
},
|
|
"/media": {
|
|
target: process.env.CRM_API_URL || "http://127.0.0.1:47613",
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
});
|