diff --git a/packages/taro-cli/src/mini/component.ts b/packages/taro-cli/src/mini/component.ts index b24484af58f4..29390c0f526d 100644 --- a/packages/taro-cli/src/mini/component.ts +++ b/packages/taro-cli/src/mini/component.ts @@ -247,7 +247,7 @@ export async function buildSingleComponent ( const importTaroSelfComponents = getImportTaroSelfComponents(outputComponentJSPath, res.taroSelfComponents) const importCustomComponents = new Set(realComponentsPathList.map(item => { return { - path: path.relative(path.dirname(component), item.path as string).replace(path.extname(item.path as string), ''), + path: promoteRelativePath(path.relative(component, item.path as string)).replace(path.extname(item.path as string), ''), name: item.name as string } })) @@ -262,7 +262,7 @@ export async function buildSingleComponent ( template: componentWXMLContent }) fs.writeFileSync(outputComponentWXMLPath, uxTxt) - printLog(processTypeEnum.GENERATE, '组件文件', `${outputDirName}/${componentObj.name}${outputFilesTypes.TEMPL}`) + printLog(processTypeEnum.GENERATE, '组件文件', `${outputComponentShowPath}${outputFilesTypes.TEMPL}`) } const dependencyTree = getDependencyTree() diff --git a/packages/taro-cli/src/mini/page.ts b/packages/taro-cli/src/mini/page.ts index 5b7a105c52a9..d810d4304716 100644 --- a/packages/taro-cli/src/mini/page.ts +++ b/packages/taro-cli/src/mini/page.ts @@ -169,7 +169,7 @@ export async function buildSinglePage (page: string) { const importTaroSelfComponents = getImportTaroSelfComponents(outputPageJSPath, res.taroSelfComponents) const importCustomComponents = new Set(realComponentsPathList.map(item => { return { - path: path.relative(path.dirname(pageJs), item.path as string).replace(path.extname(item.path as string), ''), + path: promoteRelativePath(path.relative(pageJs, item.path as string)).replace(path.extname(item.path as string), ''), name: item.name as string } }))