Ai
3 Star 2 Fork 1

chenroaming/vue3-vantUI-typeScript-vite

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.ts 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
import { fileURLToPath, URL } from 'node:url'
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import Components from 'unplugin-vue-components/vite'
import { VantResolver } from 'unplugin-vue-components/resolvers'
const port = 8081
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
// 默认加载所有环境变量
const env = loadEnv(mode, process.cwd(), '')
return {
plugins: [
vue(),
vueJsx(),
Components({
resolvers: [VantResolver()]
})
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server: {
host: '0.0.0.0',
port,
open: true,
proxy: {
// 详情参阅: https://cn.vitejs.dev/config/server-options.html
[env.VITE_APP_BASE_API]: {
// 这里以天天基金网的接口为示例
target: 'https://api.fund.eastmoney.com',
changeOrigin: true, // 是否跨域
rewrite: (path) => path.replace(env.VITE_APP_BASE_API, '') // 重写路由路径
}
}
}
}
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/chenroaming/vue3-vant-ui-type-script-vite.git
git@gitee.com:chenroaming/vue3-vant-ui-type-script-vite.git
chenroaming
vue3-vant-ui-type-script-vite
vue3-vantUI-typeScript-vite
dev

搜索帮助