From 99a5fac97dc0224b99606eccdc9180c3bdc9aa2e Mon Sep 17 00:00:00 2001 From: yutent Date: Fri, 12 May 2023 18:47:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=90=8D=E5=92=8C=E9=A1=B5=E9=9D=A2=E5=90=8D=E5=AD=97?= =?UTF-8?q?=E7=9B=B8=E5=90=8C=E6=97=B6=E9=80=BB=E8=BE=91=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/dev.js | 6 ++++-- package.json | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/dev.js b/lib/dev.js index 8b3f418..b34e5d4 100644 --- a/lib/dev.js +++ b/lib/dev.js @@ -164,7 +164,8 @@ export default async function createServer(root = '', conf = {}) { let file if (IS_MPA) { - if (rpath.startsWith(currentPage)) { + // 判断前后2个值相等, 避免出现目录名和页面名字相同时走错逻辑 + if (rpath === pathname && rpath.startsWith(currentPage)) { file = join(pagesDir, rpath.slice(currentPage.length)) } else { file = join(SOURCE_DIR, rpath) @@ -217,7 +218,8 @@ export default async function createServer(root = '', conf = {}) { let file if (IS_MPA) { - if (rpath.startsWith(currentPage)) { + // 判断前后2个值相等, 避免出现目录名和页面名字相同时走错逻辑 + if (rpath === pathname && rpath.startsWith(currentPage)) { file = join(pagesDir, rpath.slice(currentPage.length)) } else { file = join(SOURCE_DIR, rpath) diff --git a/package.json b/package.json index 0eaa296..d98f165 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fite", "type": "module", - "version": "0.9.2", + "version": "0.9.3", "bin": { "fite": "index.js" },