1 Star 0 Fork 0

不怕死Da佩奇/byd_project_uni

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.ts 2.15 KB
一键复制 编辑 原始数据 按行查看 历史
不怕死Da佩奇 提交于 2024-12-28 14:48 . 时间轴循环滚动完成
import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import { resolve } from 'path'
import Icons from 'unplugin-icons/vite'
import IconsResolver from 'unplugin-icons/resolver'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
// #ifdef APP
// const getUnoCss = async () => {
// const UnoCss = await import('unocss/vite').then(i => i.default)
// return UnoCss()
// }
// #endif
export default defineConfig({
// #ifdef APP
define: {
__VUE_I18N_FULL_INSTALL__: false,
__VUE_I18N_LEGACY_API__: false,
__INTLIFY_PROD_DEVTOOLS__: false,
},
// #endif
build: {
sourcemap: process.env.NODE_ENV === 'development',
},
resolve: {
alias: [
{
find: '@',
replacement: resolve(__dirname, 'src'),
},
],
},
plugins: [
uni(),
// #ifdef APP
// getUnoCss(),
// #endif
// #ifdef WEB
AutoImport({
resolvers: [ElementPlusResolver(), IconsResolver({ prefix: 'Icon' })],
}),
Components({
resolvers: [ElementPlusResolver(), IconsResolver({ enabledCollections: ['ep'] })],
}),
Icons({
autoInstall: true,
}),
// #endif
],
// #ifdef WEB
optimizeDeps: {
include: ['vue-grid-layout-v3', 'element-resize-detector'],
},
// #endif
server: {
host: 'localhost',
port: 3000,
open: true,
proxy: {
'/apiline': {
target: 'http://zjkb.wudangsh.cn',
changeOrigin: true,
timeout: 20000,
rewrite: (path: any) => path.replace(/^\/apiline/, ''),
},
'/api': { // 这里的'/api'要和nginx配置中代理的路径前缀对应,即匹配以/api开头的请求
target: 'http://47.115.133.47', // 指向nginx服务地址及端口,因为nginx会进一步做转发
changeOrigin: true, // 改变请求源,让后端认为请求来自nginx而不是前端直接发起
rewrite: (path) => path.replace(/^\/api/, ''), // 重写路径,去掉前端请求中/api前缀,与nginx中处理的路径规则配合
timeout:20000,
},
},
}
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dont-be-afraid-to-die-da-page/byd_project_uni.git
[email protected]:dont-be-afraid-to-die-da-page/byd_project_uni.git
dont-be-afraid-to-die-da-page
byd_project_uni
byd_project_uni
master

搜索帮助