web-backset.cn/apps/web/vite.config.ts

44 lines
1.0 KiB
TypeScript
Raw Normal View History

2023-02-27 11:23:36 +08:00
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import tsconfigPaths from "vite-tsconfig-paths";
2023-03-21 10:39:35 +08:00
import { visualizer } from "rollup-plugin-visualizer";
import viteCompression from "vite-plugin-compression";
2023-02-27 11:23:36 +08:00
// https://vitejs.dev/config/
export default defineConfig({
2023-03-21 10:39:35 +08:00
plugins: [
react(),
tsconfigPaths(),
visualizer({
open: true, //注意这里要设置为true否则无效
gzipSize: true,
brotliSize: true,
}),
viteCompression(),
],
2023-03-12 22:30:09 +08:00
server: {
proxy: {
"/api": {
rewrite: (path) => path.replace(/^\/api/, ""),
target: "http://127.0.0.1:7001/api/v1",
changeOrigin: true,
},
},
},
2023-03-21 10:39:35 +08:00
build: {
// rollupOptions: {
// output: {
// manualChunks(id) {
// if (id.includes("node_modules")) {
// return id
// .toString()
// .split("node_modules/")[1]
// .split("/")[0]
// .toString();
// }
// },
// },
// },
},
2023-02-27 11:23:36 +08:00
});