提交 50041aa9 编写于 作者: Q qiang

fix: h5.router.base 为相对路径时,mode 强制为 hash

上级 a448af45
...@@ -66,6 +66,10 @@ function getH5Options (manifestJson) { ...@@ -66,6 +66,10 @@ function getH5Options (manifestJson) {
if (!base.endsWith('/')) { if (!base.endsWith('/')) {
base = base + '/' base = base + '/'
} }
// 相对路径仅支持 hash 模式
if (base.startsWith('./')) {
h5.router.mode = defaultRouter.mode
}
h5.router.base = base h5.router.base = base
...@@ -77,8 +81,8 @@ function getH5Options (manifestJson) { ...@@ -77,8 +81,8 @@ function getH5Options (manifestJson) {
} }
} else { // 其他模式,启用 base } else { // 其他模式,启用 base
if(base.startsWith('./')) { if (base.startsWith('./')) {
// 在开发模式, publicPath 如果为 './' webpack-dev-server 匹配文件时会失败 // 在开发模式, publicPath 如果为 './' webpack-dev-server 匹配文件时会失败
h5.publicPath = base.substr(1) h5.publicPath = base.substr(1)
} else { } else {
h5.publicPath = base h5.publicPath = base
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册