You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yolov8/MTAS-guest/vite.config.ts

80 lines
1.9 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import vue from "@vitejs/plugin-vue";
import path from "path";
import AutoImport from "unplugin-auto-import/vite";
import { NaiveUiResolver } from "unplugin-vue-components/resolvers";
import Components from "unplugin-vue-components/vite";
import { defineConfig } from "vite";
import { prismjsPlugin } from "vite-plugin-prismjs";
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
// 官网https://vitejs.dev/
// https://vitejs.dev/config/
export default defineConfig({
server: {
port: 8090, // 前端端口
open: true,
proxy: {
"/api": {
target: "http://localhost:5500",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
},
},
},
plugins: [
vue(),
// 自动帮忙导入
AutoImport({
imports: ["vue", "vue-router", "pinia"],
dts: "src/types/auto-imports.d.ts",
}),
Components({
resolvers: [NaiveUiResolver()],
dts: "src/types/components.d.ts",
}),
createSvgIconsPlugin({
// 指定需要缓存的图标文件夹
iconDirs: [path.resolve(process.cwd(), "src/assets/icons")],
// 指定symbolId格式
symbolId: "icon-[dir]-[name]",
}),
prismjsPlugin({
languages: [
"java",
"python",
"html",
"css",
"sass",
"less",
"go",
"cpp",
"c",
"js",
"ts",
"sql",
"bash",
"git",
"nginx",
"php",
],
theme: "tomorrow",
css: true,
}),
],
// 解析 设置 resolve
resolve: {
// https://cn.vitejs.dev/config/#resolve-alias
alias: {
// 设置路径
"~": path.resolve(__dirname, "./"),
// 设置别名
"@": path.resolve(__dirname, "./src"),
},
// https://cn.vitejs.dev/config/#resolve-extensions
extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
},
});