提交 766495a9 编写于 作者: Q qiang

fix: HBuilderX BuiltInComponentPath

上级 bdb83de9
......@@ -92,6 +92,8 @@ const NODE_MODULES_REGEX = /(\.\.\/)?node_modules/g
function normalizeNodeModules (str) {
str = normalizePath(str).replace(NODE_MODULES_REGEX, 'node-modules')
// HBuilderX 内置模块路径转换
str = str.replace(/.*HBuilderX\/plugins\/uniapp-cli\/node[-_]modules/, 'node-modules')
if (process.env.UNI_PLATFORM === 'mp-alipay') {
str = str.replace('node-modules/@', 'node-modules/npm-scope-')
}
......@@ -136,4 +138,4 @@ module.exports = {
getTemplatePath () {
return path.join(__dirname, '../template')
}
}
}
......@@ -89,11 +89,7 @@ module.exports = function generateComponent (compilation) {
let resource = normalizePath(path.resolve(process.env.UNI_INPUT_DIR, '..', modulePath))
const altResource = normalizePath(path.resolve(process.env.UNI_INPUT_DIR, modulePath))
if (
/^win/.test(process.platform) &&
modulePath.includes('@dcloudio') &&
isBuiltInComponentPath(modulePath)
) {
if (modulePath.includes('@dcloudio') && isBuiltInComponentPath(modulePath)) {
resource = normalizePath(path.resolve(process.env.UNI_CLI_CONTEXT, modulePath))
}
......@@ -234,4 +230,4 @@ function removeUnusedComponent (name) {
fs.renameSync(path.join(process.env.UNI_OUTPUT_DIR, name + '.json'), path.join(process.env.UNI_OUTPUT_DIR, name +
'.bak.json'))
} catch (e) {}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册