57 lines
1.3 KiB
TypeScript
57 lines
1.3 KiB
TypeScript
import { fileURLToPath, URL } from "node:url";
|
|
import { defineConfig } from "vite";
|
|
import vue from "@vitejs/plugin-vue";
|
|
import viteConfitExtend from "./vite.config.extend";
|
|
|
|
import AutoImport from "unplugin-auto-import/vite";
|
|
import Components from "unplugin-vue-components/vite";
|
|
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
|
|
|
|
const subDir: string = "adminlockui"; //输出到子目录
|
|
const appTitle: string = "温德姆酒店远程开门小程序后台管理"; //全局变量
|
|
|
|
export default defineConfig({
|
|
// https://vitejs.dev/config/
|
|
build: {
|
|
outDir: "dist",
|
|
assetsDir: subDir,
|
|
copyPublicDir: true,
|
|
},
|
|
define: {
|
|
appTitle: JSON.stringify(appTitle),
|
|
subDir: JSON.stringify(subDir),
|
|
},
|
|
plugins: [
|
|
vue(),
|
|
AutoImport({
|
|
resolvers: [ElementPlusResolver()],
|
|
// 解决eslint报错问题
|
|
eslintrc: {
|
|
enabled: true,
|
|
},
|
|
}),
|
|
Components({
|
|
resolvers: [ElementPlusResolver()],
|
|
}),
|
|
viteConfitExtend({
|
|
indexPath: `${subDir}/index.html`,
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
|
},
|
|
},
|
|
server: {
|
|
open: true,
|
|
proxy: {
|
|
"/api": {
|
|
target: "http://192.168.1.2:3101",
|
|
},
|
|
"/fileserver": {
|
|
target: "http://192.168.1.2:3101",
|
|
},
|
|
},
|
|
},
|
|
});
|