1 Star 0 Fork 5

Yzi/eva-cms-admin-front

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.js 1.04 KB
一键复制 编辑 原始数据 按行查看 历史
刘大逵 提交于 2024-10-11 15:13 +08:00 . 静态资源路径调整
import { fileURLToPath, URL } from 'node:url'
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import eslint from 'vite-plugin-eslint'
// https://vitejs.dev/config/
export default ({mode}) => {
const apiPrefix = loadEnv(mode, process.cwd()).VITE_APP_API_PREFIX
const apiUrl = loadEnv(mode, process.cwd()).VITE_APP_API_URL
return defineConfig({
plugins: [
vue(),
eslint({
include: ['src/**/*.js', 'src/**/*.vue'],
exclude: ['node_modules']
})
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
extensions: ['.vue', '.js']
},
server: {
host: '0.0.0.0',
port: 10086,
proxy: {
// 接口代理
[apiPrefix]: {
target: apiUrl,
changeOrigin: true,
rewrite: (path) => path.replace(new RegExp(`^${apiPrefix}`), "")
},
// 静态资源代理
'/resource': {
target: apiUrl,
changeOrigin: true
}
}
}
})
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/scer/eva-cms-admin-front.git
git@gitee.com:scer/eva-cms-admin-front.git
scer
eva-cms-admin-front
eva-cms-admin-front
master

搜索帮助