CORS problem solution

This commit is contained in:
2026-07-03 12:51:34 +05:00
parent c44534bf66
commit 96ca70d9f9
7 changed files with 24 additions and 33 deletions

View File

@@ -1,19 +1,23 @@
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import { defineConfig, loadEnv } from 'vite';
export default defineConfig({
plugins: [react()],
build: {
chunkSizeWarningLimit: 700,
},
server: {
port: 5173,
proxy: {
'/api': {
target: 'https://beta.backend.drill.greact.ru',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
export default defineConfig(({ mode }) => {
const { DEV_API_URL } = loadEnv(mode, '.', '');
return {
plugins: [react()],
build: {
chunkSizeWarningLimit: 700,
},
server: {
port: 5173,
proxy: {
'/api': {
target: DEV_API_URL,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
},
},
};
});