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" },