mirror of
https://github.com/jiangrui1994/CloudSaver.git
synced 2026-01-09 14:48:47 +08:00
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import vue from "@vitejs/plugin-vue";
|
|
import { fileURLToPath, URL } from "node:url";
|
|
import AutoImport from "unplugin-auto-import/vite";
|
|
import Components from "unplugin-vue-components/vite";
|
|
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
|
|
|
|
export default defineConfig({
|
|
base: "/",
|
|
plugins: [
|
|
vue(),
|
|
AutoImport({
|
|
resolvers: [ElementPlusResolver()],
|
|
}),
|
|
Components({
|
|
resolvers: [ElementPlusResolver()],
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
|
},
|
|
},
|
|
server: {
|
|
host: "0.0.0.0",
|
|
port: 8008,
|
|
proxy: {
|
|
"/api": {
|
|
target: process.env.VITE_API_BASE_URL_PROXY || "http://127.0.0.1:8009",
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/api/, ""),
|
|
configure: (proxy, _options) => {
|
|
proxy.on("error", (err, _req, _res) => {
|
|
console.log("proxy error", err);
|
|
});
|
|
proxy.on("proxyReq", (proxyReq, req, _res) => {
|
|
console.log("Sending Request:", req.method, req.url);
|
|
});
|
|
proxy.on("proxyRes", (proxyRes, req, _res) => {
|
|
console.log("Received Response:", proxyRes.statusCode, req.url);
|
|
});
|
|
},
|
|
},
|
|
},
|
|
},
|
|
build: {
|
|
outDir: "dist",
|
|
assetsDir: "assets",
|
|
rollupOptions: {
|
|
input: {
|
|
main: fileURLToPath(new URL("./index.html", import.meta.url)),
|
|
},
|
|
},
|
|
},
|
|
});
|