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.
56 lines
1.6 KiB
56 lines
1.6 KiB
import vue from "@vitejs/plugin-vue";
|
|
import path from "path";
|
|
import AutoImport from "unplugin-auto-import/vite";
|
|
import { ElementPlusResolver } 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/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
AutoImport({
|
|
resolvers: [ElementPlusResolver()],
|
|
}),
|
|
Components({
|
|
resolvers: [ElementPlusResolver()],
|
|
}),
|
|
createSvgIconsPlugin({
|
|
// 指定需要缓存的图标文件夹
|
|
iconDirs: [path.resolve(process.cwd(), "src/assets/icons")],
|
|
// 指定symbolId格式
|
|
symbolId: "icon-[dir]-[name]",
|
|
}),
|
|
prismjsPlugin({
|
|
languages: ["java", "python", "go", "html", "json"],
|
|
plugins: ["copy-to-clipboard"],
|
|
theme: "okaidia",
|
|
css: true,
|
|
}),
|
|
],
|
|
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"],
|
|
},
|
|
server: {
|
|
port: 8080, // 前端端口
|
|
open: true,
|
|
proxy: {
|
|
"/api": {
|
|
target: "http://localhost:5500",
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/api/, ""),
|
|
},
|
|
},
|
|
},
|
|
});
|