-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
41 lines (41 loc) · 1.04 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { fileURLToPath, URL } from "node:url";
import eslintPlugin from "vite-plugin-eslint";
// https://vitejs.dev/config/
export default defineConfig({
base: "./",
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url))
}
},
plugins: [
vue(),
eslintPlugin({
include: ["src/**/*.js", "src/**/*.vue", "src/*.js", "src/*.vue"]
})
],
server: {
/** 是否开启 HTTPS */
https: false,
/** 设置 host: true 才可以使用 Network 的形式,以 IP 访问项目 */
host: true, // host: "0.0.0.0"
/** 端口号 */
port: 3333,
/** 是否自动打开浏览器 */
open: false,
/** 跨域设置允许 */
cors: true,
/** 端口被占用时,是否直接退出 */
strictPort: false,
/** 接口代理 */
proxy: {
"/api/v1": {
target: "http://localhost:5163",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/v1/, "")
}
}
}
});