修复文件目录名和页面名字相同时逻辑处理错误的bug

pull/1/head
yutent 2023-05-12 18:47:06 +08:00
parent 472aa4d116
commit 99a5fac97d
2 changed files with 5 additions and 3 deletions

View File

@ -164,7 +164,8 @@ export default async function createServer(root = '', conf = {}) {
let file let file
if (IS_MPA) { if (IS_MPA) {
if (rpath.startsWith(currentPage)) { // 判断前后2个值相等, 避免出现目录名和页面名字相同时走错逻辑
if (rpath === pathname && rpath.startsWith(currentPage)) {
file = join(pagesDir, rpath.slice(currentPage.length)) file = join(pagesDir, rpath.slice(currentPage.length))
} else { } else {
file = join(SOURCE_DIR, rpath) file = join(SOURCE_DIR, rpath)
@ -217,7 +218,8 @@ export default async function createServer(root = '', conf = {}) {
let file let file
if (IS_MPA) { if (IS_MPA) {
if (rpath.startsWith(currentPage)) { // 判断前后2个值相等, 避免出现目录名和页面名字相同时走错逻辑
if (rpath === pathname && rpath.startsWith(currentPage)) {
file = join(pagesDir, rpath.slice(currentPage.length)) file = join(pagesDir, rpath.slice(currentPage.length))
} else { } else {
file = join(SOURCE_DIR, rpath) file = join(SOURCE_DIR, rpath)

View File

@ -1,7 +1,7 @@
{ {
"name": "fite", "name": "fite",
"type": "module", "type": "module",
"version": "0.9.2", "version": "0.9.3",
"bin": { "bin": {
"fite": "index.js" "fite": "index.js"
}, },