From 50041aa946bbc9a7f2adfe48a19aee3eccdf09c6 Mon Sep 17 00:00:00 2001 From: qiang Date: Fri, 13 Mar 2020 13:48:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20h5.router.base=20=E4=B8=BA=E7=9B=B8?= =?UTF-8?q?=E5=AF=B9=E8=B7=AF=E5=BE=84=E6=97=B6=EF=BC=8Cmode=20=E5=BC=BA?= =?UTF-8?q?=E5=88=B6=E4=B8=BA=20hash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/uni-cli-shared/lib/manifest.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/uni-cli-shared/lib/manifest.js b/packages/uni-cli-shared/lib/manifest.js index e8a832db..3bbd492d 100644 --- a/packages/uni-cli-shared/lib/manifest.js +++ b/packages/uni-cli-shared/lib/manifest.js @@ -66,6 +66,10 @@ function getH5Options (manifestJson) { if (!base.endsWith('/')) { base = base + '/' } + // 相对路径仅支持 hash 模式 + if (base.startsWith('./')) { + h5.router.mode = defaultRouter.mode + } h5.router.base = base @@ -77,8 +81,8 @@ function getH5Options (manifestJson) { } } else { // 其他模式,启用 base - if(base.startsWith('./')) { - // 在开发模式, publicPath 如果为 './' webpack-dev-server 匹配文件时会失败 + if (base.startsWith('./')) { + // 在开发模式, publicPath 如果为 './' webpack-dev-server 匹配文件时会失败 h5.publicPath = base.substr(1) } else { h5.publicPath = base -- GitLab