Vue2.7 + Vite+ Eslint、Stylelint、Commitlint 统一开发规范 + husky + lint-staged (git commit 时自动格式化代码) + Vue 全家桶集成 + Axios 封装及接口管理 https://juejin.cn/post/7118700020911570974
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

28 lines
492 B

import { resolve } from 'path'
/**
* 对 env 对象数据类型进行转换
* @param {Object} envConf
* @returns
*/
export function wrapperEnv(envConf) {
const ret = {}
Object.keys(envConf).forEach(key => {
let val = envConf[key]
val = val === 'true' ? true : val === 'false' ? false : val
if (key === 'VITE_PORT') {
val = Number(val)
}
ret[key] = val
})
return ret
}
export function pathResolve(dir) {
return resolve(process.cwd(), '.', dir)
}