34 lines
796 B
TypeScript
34 lines
796 B
TypeScript
import { fileURLToPath, URL } from "node:url";
|
|
|
|
import { defineConfig } from "vite";
|
|
import vue from "@vitejs/plugin-vue";
|
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [vue(), vueJsx()],
|
|
resolve: {
|
|
alias: {
|
|
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
|
},
|
|
},
|
|
css: {
|
|
preprocessorOptions: {
|
|
scss: {
|
|
api: "modern-compiler", // or "modern", "legacy"
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
proxy: {
|
|
// "/api"以及前置字符串会被替换成真正的域名
|
|
"/api": {
|
|
target: "请求域名",
|
|
secure: false, //请求是否为https
|
|
changeOrigin: true, //是否为跨域
|
|
rewrite: (path) => path.replace(/^\/api/, ""),
|
|
},
|
|
},
|
|
},
|
|
});
|