提交 4510acbc 编写于 作者: Q qiang

fix(mp-toutiao): 修复编译 unicloud-db 组件报错的问题 fixed #2450

上级 b1cf5f29
......@@ -6,8 +6,7 @@ const {
getPlatformExts
} = require('@dcloudio/uni-cli-shared')
const {
getComponentSet,
getJsonFile
getComponentSet
} = require('@dcloudio/uni-cli-shared/lib/cache')
const {
......@@ -151,9 +150,10 @@ module.exports = function generateComponent (compilation, jsonpFunction = 'webpa
if (name.endsWith(fixExtname)) {
const source = assets[name].source()
const [ownerName, parentName, componentName, slotName] = source.split(',')
const json = getJsonFile(ownerName)
if (json) {
const data = JSON.parse(json)
const json = assets[ownerName + '.json']
const jsonSource = json.source()
if (jsonSource) {
const data = JSON.parse(jsonSource)
const usingComponents = data.usingComponents || {}
const componentPath = normalizePath(path.relative('/', usingComponents[parentName]))
const slots = fixSlots[componentPath] = fixSlots[componentPath] || {}
......@@ -221,7 +221,7 @@ function addComponent (name) {
if (fs.existsSync(bakJson)) {
try {
fs.renameSync(bakJson, path.join(process.env.UNI_OUTPUT_DIR, name + '.json'))
} catch (e) {}
} catch (e) { }
}
}
......@@ -229,5 +229,5 @@ function removeUnusedComponent (name) {
try {
fs.renameSync(path.join(process.env.UNI_OUTPUT_DIR, name + '.json'), path.join(process.env.UNI_OUTPUT_DIR, name +
'.bak.json'))
} catch (e) {}
}
} catch (e) { }
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册