Skip to content

Commit

Permalink
add proxy example
Browse files Browse the repository at this point in the history
  • Loading branch information
johnb8005 authored Dec 17, 2023
1 parent cdb1ada commit c13d264
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";

// add proxy, optional
const proxy: { [l: string]: ProxyOptions } = {
"^/api/.*": {
target: "http://localhost:3002",
changeOrigin: true,
secure: false,
rewrite: (path: string) => path.replace(/^\/api\/, ""),
},
};

// this the default/base configuration
const baseConfig = {
plugins: [react()],
test: {
// ...
}
},
server: { proxy }
};

// https://vitejs.dev/config/
Expand Down

0 comments on commit c13d264

Please sign in to comment.