44 lines
1.0 KiB
TypeScript
44 lines
1.0 KiB
TypeScript
import { defineConfig } from "vite";
|
||
import react from "@vitejs/plugin-react";
|
||
import tsconfigPaths from "vite-tsconfig-paths";
|
||
import { visualizer } from "rollup-plugin-visualizer";
|
||
import viteCompression from "vite-plugin-compression";
|
||
|
||
// https://vitejs.dev/config/
|
||
export default defineConfig({
|
||
plugins: [
|
||
react(),
|
||
tsconfigPaths(),
|
||
visualizer({
|
||
open: true, //注意这里要设置为true,否则无效
|
||
gzipSize: true,
|
||
brotliSize: true,
|
||
}),
|
||
viteCompression(),
|
||
],
|
||
server: {
|
||
proxy: {
|
||
"/api": {
|
||
rewrite: (path) => path.replace(/^\/api/, ""),
|
||
target: "http://127.0.0.1:7001/api/v1",
|
||
changeOrigin: true,
|
||
},
|
||
},
|
||
},
|
||
build: {
|
||
// rollupOptions: {
|
||
// output: {
|
||
// manualChunks(id) {
|
||
// if (id.includes("node_modules")) {
|
||
// return id
|
||
// .toString()
|
||
// .split("node_modules/")[1]
|
||
// .split("/")[0]
|
||
// .toString();
|
||
// }
|
||
// },
|
||
// },
|
||
// },
|
||
},
|
||
});
|