From 4b91a1972b432f35c809feeb690b57633bbf2668 Mon Sep 17 00:00:00 2001 From: ZauberNerd Date: Sat, 8 Jul 2023 10:57:34 +0200 Subject: [PATCH] Replace CRA proxy config with vite's proxy config --- app/package.json | 1 - app/src/setupProxy.js | 14 -------------- app/vite.config.js | 9 +++++++++ 3 files changed, 9 insertions(+), 15 deletions(-) delete mode 100644 app/src/setupProxy.js diff --git a/app/package.json b/app/package.json index 66721a1..33f1bbf 100644 --- a/app/package.json +++ b/app/package.json @@ -69,7 +69,6 @@ "@types/uuid": "^9.0.1", "@vitejs/plugin-react": "^4.0.2", "babel-plugin-formatjs": "^10.5.3", - "http-proxy-middleware": "^2.0.6", "typescript": "^4.9.5", "vite": "^4.4.1", "vite-plugin-comlink": "^3.0.5" diff --git a/app/src/setupProxy.js b/app/src/setupProxy.js deleted file mode 100644 index 06b4038..0000000 --- a/app/src/setupProxy.js +++ /dev/null @@ -1,14 +0,0 @@ -/* eslint-disable @typescript-eslint/no-var-requires */ -/* eslint-disable no-undef */ -const { createProxyMiddleware } = require('http-proxy-middleware'); - -module.exports = function (app) { - app.use( - '/chatapi', - createProxyMiddleware({ - target: 'http://localhost:3001', - secure: false, - changeOrigin: true, - }) - ); -}; \ No newline at end of file diff --git a/app/vite.config.js b/app/vite.config.js index 5bcc743..e8aefa1 100644 --- a/app/vite.config.js +++ b/app/vite.config.js @@ -4,6 +4,15 @@ import { comlink } from "vite-plugin-comlink"; export default defineConfig(() => { return { + server: { + proxy: { + "/chatapi": { + target: "http://localhost:3001", + secure: false, + changeOrigin: true, + }, + }, + }, build: { outDir: "build", },