Skip to content

Commit

Permalink
fix(taroize): 修复插件usingComonent路径 plugin:// 开头转换报错
Browse files Browse the repository at this point in the history
  • Loading branch information
honlyHuang committed Aug 7, 2019
1 parent 0bd5226 commit bc200e1
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions packages/taro-cli/src/convertor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,17 +510,28 @@ export default class Convertor {
const pageUsingComponnets = pageConfig.usingComponents
if (pageUsingComponnets) {
// 页面依赖组件
let usingComponents = {}
Object.keys(pageUsingComponnets).forEach(component => {
let componentPath = path.resolve(pageConfigPath, '..', pageUsingComponnets[component])
if (!fs.existsSync(resolveScriptPath(componentPath))) {
componentPath = path.join(this.root, pageUsingComponnets[component])
}
depComponents.add({
name: component,
path: componentPath
})

if (pageUsingComponnets[component].startsWith('plugin://')) {
usingComponents[pascalCase(component)] = pageUsingComponnets[component]
} else {
depComponents.add({
name: component,
path: componentPath
})
}
})
delete pageConfig.usingComponents
if (Object.keys(usingComponents).length === 0) {
delete pageConfig.usingComponents
} else {
pageConfig.usingComponents = usingComponents
}

}
param.json = JSON.stringify(pageConfig)
}
Expand Down

0 comments on commit bc200e1

Please sign in to comment.