build(projects): vite.config代码优化

This commit is contained in:
Soybean
2022-03-13 16:47:19 +08:00
parent d0522ce514
commit ca707a456b
13 changed files with 94 additions and 52 deletions

15
build/config/path.ts Normal file
View File

@ -0,0 +1,15 @@
import { fileURLToPath } from 'url';
/**
* 解析路径
* @param basePath - 基础路径
*/
export function resolvePath(rootPath: string, basePath: string) {
const root = fileURLToPath(new URL(rootPath, basePath));
const src = `${root}src`;
return {
root,
src,
};
}