UNPKG

@neosjs/cli

Version:

Neos(奈欧斯)是一个帮助开发者快速地创建 Vue3 应用并自动配置项目编译的脚手架

20 lines (18 loc) 512 B
import type { ProxyOptions } from 'vite' type ProxyItem = [string, string] type ProxyList = ProxyItem[] type ProxyTargetList = Record<string, ProxyOptions> const httpsRE = /^https:\/\// export function createViteProxy(list: ProxyList = []) { const ret: ProxyTargetList = {} for (const [prefix, target] of list) { const isHttps = httpsRE.test(target) ret[prefix] = { target: target, changeOrigin: true, ws: true, ...(isHttps ? { secure: false } : {}) } } return ret }