Replace CRA proxy config with vite's proxy config

main
ZauberNerd 2023-07-08 10:57:34 +02:00
parent a3da33d824
commit 4b91a1972b
No known key found for this signature in database
GPG Key ID: 9B617FBFF79E4F60
3 changed files with 9 additions and 15 deletions

View File

@ -69,7 +69,6 @@
"@types/uuid": "^9.0.1", "@types/uuid": "^9.0.1",
"@vitejs/plugin-react": "^4.0.2", "@vitejs/plugin-react": "^4.0.2",
"babel-plugin-formatjs": "^10.5.3", "babel-plugin-formatjs": "^10.5.3",
"http-proxy-middleware": "^2.0.6",
"typescript": "^4.9.5", "typescript": "^4.9.5",
"vite": "^4.4.1", "vite": "^4.4.1",
"vite-plugin-comlink": "^3.0.5" "vite-plugin-comlink": "^3.0.5"

View File

@ -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,
})
);
};

View File

@ -4,6 +4,15 @@ import { comlink } from "vite-plugin-comlink";
export default defineConfig(() => { export default defineConfig(() => {
return { return {
server: {
proxy: {
"/chatapi": {
target: "http://localhost:3001",
secure: false,
changeOrigin: true,
},
},
},
build: { build: {
outDir: "build", outDir: "build",
}, },