50 lines
1.4 KiB
JavaScript
50 lines
1.4 KiB
JavaScript
import { defineConfig } from "vite";
|
|
import vue from "@vitejs/plugin-vue";
|
|
import path from "path";
|
|
import Inspector from 'vite-plugin-vue-inspector';
|
|
import tailwindcss from "tailwindcss";
|
|
import autoprefixer from "autoprefixer";
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
import Components from 'unplugin-vue-components/vite'
|
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
Inspector(),
|
|
AutoImport({
|
|
resolvers: [ElementPlusResolver()],
|
|
}),
|
|
Components({
|
|
resolvers: [ElementPlusResolver()],
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "src"), // 设置@为src目录的别名
|
|
},
|
|
},
|
|
server: {
|
|
port: 4280, // 启动端口号
|
|
host: true, // 开启热点ip地址
|
|
open: true, // 启动是否自动打开浏览器预览
|
|
strictPort: false, // 端口被占用时是否直接退出
|
|
cors: true, // 允许跨域
|
|
headers: {}, // 设置请求头
|
|
proxy: {
|
|
"/api": {
|
|
// target: 'http://hb.frp.one:16110', // 代理目标地址
|
|
// target: "http://127.0.0.1:10084",
|
|
target: "https://work-api.ruzhiyuan.com",
|
|
changeOrigin: true, // 是否开启代理
|
|
rewrite: (path) => path.replace(/^\/api/, ""), // 重写路径
|
|
},
|
|
},
|
|
},
|
|
css: {
|
|
postcss: {
|
|
plugins: [tailwindcss, autoprefixer],
|
|
},
|
|
},
|
|
});
|