提交 80346f31 编写于 作者: D DCloud_LXH

fix(mp): 编译分包组件引入添加相对路径

上级 9d005a29
...@@ -95,6 +95,8 @@ function analyzeUsingComponents () { ...@@ -95,6 +95,8 @@ function analyzeUsingComponents () {
// }, {}) // }, {})
} }
const parseRequirePath = path => /^[A-z]/.test(path) ? `./${path}` : path
function normalizeUsingComponents (file, usingComponents) { function normalizeUsingComponents (file, usingComponents) {
const names = Object.keys(usingComponents) const names = Object.keys(usingComponents)
if (!names.length) { if (!names.length) {
...@@ -102,7 +104,7 @@ function normalizeUsingComponents (file, usingComponents) { ...@@ -102,7 +104,7 @@ function normalizeUsingComponents (file, usingComponents) {
} }
file = path.dirname('/' + file) file = path.dirname('/' + file)
names.forEach(name => { names.forEach(name => {
usingComponents[name] = normalizePath(path.relative(file, usingComponents[name])) usingComponents[name] = normalizePath(parseRequirePath(path.relative(file, usingComponents[name])))
}) })
return usingComponents return usingComponents
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册