Files
dcalc/frontendNew/vite.config.ts
T
2026-05-28 13:16:24 +08:00

56 lines
1.5 KiB
TypeScript

import path from "node:path";
import { defineConfig } from "vite";
import tailwindcss from "@tailwindcss/vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import vueDevTools from "vite-plugin-vue-devtools";
import AutoImport from "unplugin-auto-import/vite";
// https://vite.dev/config/
export default defineConfig({
plugins: [
tailwindcss(),
vue(),
vueJsx(),
vueDevTools(),
AutoImport({
imports: ["vue", "vue-router", "@vueuse/core"],
include: [
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
/\.vue$/,
/\.vue\?vue/, // .vue
],
dts: "src/types/auto-imports.d.ts", // specify the dts file path
// 解决eslint报错问题
eslintrc: {
// 这里先设置成true然后npm run dev 运行之后会生成 .eslintrc-auto-import.json 文件之后,在改为false
enabled: true,
filepath: "./.eslintrc-auto-import.json", // 生成的文件路径
globalsPropValue: true,
},
}),
],
base: "new",
server: {
host: "0.0.0.0",
proxy: {
"/api": {
target: "http://127.0.0.1:47173/api",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
},
"/image": {
target: "http://127.0.0.1:3000",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/image/, ""),
},
},
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
});