From 80346f31ba3de6b06fd98cdddf8412954d6eb071 Mon Sep 17 00:00:00 2001 From: DCloud_LXH <283700113@qq.com> Date: Thu, 23 Sep 2021 15:33:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(mp):=20=E7=BC=96=E8=AF=91=E5=88=86=E5=8C=85?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=BC=95=E5=85=A5=E6=B7=BB=E5=8A=A0=E7=9B=B8?= =?UTF-8?q?=E5=AF=B9=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/webpack-uni-mp-loader/lib/plugin/generate-json.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/webpack-uni-mp-loader/lib/plugin/generate-json.js b/packages/webpack-uni-mp-loader/lib/plugin/generate-json.js index 80655b696..493b6f477 100644 --- a/packages/webpack-uni-mp-loader/lib/plugin/generate-json.js +++ b/packages/webpack-uni-mp-loader/lib/plugin/generate-json.js @@ -95,6 +95,8 @@ function analyzeUsingComponents () { // }, {}) } +const parseRequirePath = path => /^[A-z]/.test(path) ? `./${path}` : path + function normalizeUsingComponents (file, usingComponents) { const names = Object.keys(usingComponents) if (!names.length) { @@ -102,7 +104,7 @@ function normalizeUsingComponents (file, usingComponents) { } file = path.dirname('/' + file) names.forEach(name => { - usingComponents[name] = normalizePath(path.relative(file, usingComponents[name])) + usingComponents[name] = normalizePath(parseRequirePath(path.relative(file, usingComponents[name]))) }) return usingComponents } -- GitLab