fix(cli): window下路径分隔符\转换为/

fix #286
This commit is contained in:
roymondchen 2022-08-18 17:16:04 +08:00 committed by jia000
parent 8f8d6ba420
commit 4e4cae4a77

View File

@ -34,7 +34,7 @@ export const resolveAppPackages = (app: App) => {
if (!moduleName) throw Error('packages中包含非法配置');
const indexPath = execSync(`node -e "console.log(require.resolve('${moduleName}'))"`, { cwd })
const indexPath = execSync(`node -e "console.log(require.resolve('${moduleName.replace(/\\/g, '/')}'))"`, { cwd })
.toString()
.replace('\n', '');
const indexCode = fs.readFileSync(indexPath, { encoding: 'utf-8', flag: 'r' });