You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
import { defineConfig } from "vite";
|
|
|
|
|
|
import vue from "@vitejs/plugin-vue";
|
|
|
|
|
|
|
|
|
|
|
|
//自动导入
|
|
|
|
|
|
import AutoImport from "unplugin-auto-import/vite";
|
|
|
|
|
|
//组件注册
|
|
|
|
|
|
import Components from "unplugin-vue-components/vite";
|
|
|
|
|
|
//解析器
|
|
|
|
|
|
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
|
|
|
|
|
|
|
|
|
|
|
|
import path from "path";
|
|
|
|
|
|
const pathSrc = path.resolve(__dirname, "src");
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
|
resolve: {
|
|
|
|
|
|
alias: { "@": pathSrc },
|
|
|
|
|
|
},
|
|
|
|
|
|
server: {
|
|
|
|
|
|
proxy: {
|
|
|
|
|
|
"/api": {
|
|
|
|
|
|
target: "http://127.0.0.1:8093",
|
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
rewrite: (path) => path.replace(/^\/api/, ""),
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
plugins: [
|
|
|
|
|
|
vue(),
|
|
|
|
|
|
AutoImport({
|
|
|
|
|
|
imports: ["vue", "@vueuse/core", "vue-router"],
|
|
|
|
|
|
resolvers: [
|
|
|
|
|
|
//自动导入elementplus相关函数,如:ElMessage,...
|
|
|
|
|
|
ElementPlusResolver(),
|
|
|
|
|
|
],
|
|
|
|
|
|
dts: path.resolve(pathSrc, "components.d.ts"),
|
|
|
|
|
|
}),
|
|
|
|
|
|
Components({
|
|
|
|
|
|
resolvers: [
|
|
|
|
|
|
//自动导入elementplus组件
|
|
|
|
|
|
ElementPlusResolver(),
|
|
|
|
|
|
],
|
|
|
|
|
|
dts: path.resolve(pathSrc, "auto-imports.d.ts"),
|
|
|
|
|
|
}),
|
|
|
|
|
|
],
|
|
|
|
|
|
base: "./",
|
|
|
|
|
|
build: {
|
|
|
|
|
|
//浏览器兼容性 "esnext"|"modules"
|
|
|
|
|
|
target: "modules",
|
|
|
|
|
|
//指定输出路径
|
|
|
|
|
|
outDir: "dist",
|
|
|
|
|
|
//生成静态资源的存放路径
|
|
|
|
|
|
assetsDir: "assets",
|
|
|
|
|
|
//chunk 大小警告的限制
|
|
|
|
|
|
chunkSizeWarningLimit: 1500,
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|