Replace CRA proxy config with vite's proxy config
parent
a3da33d824
commit
4b91a1972b
|
@ -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"
|
||||||
|
|
|
@ -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,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
};
|
|
|
@ -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",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue