From 2a80fbd14ae124eddb05deca71ebffa50de4c2ce Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Sat, 7 Jan 2023 15:49:07 +0530 Subject: [PATCH] fix(build): handle cleanUrls without trailing slash (#1772) --- src/client/app/utils.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/client/app/utils.ts b/src/client/app/utils.ts index 77d1959c..0ce332fa 100644 --- a/src/client/app/utils.ts +++ b/src/client/app/utils.ts @@ -39,8 +39,10 @@ export function pathToFile(path: string): string { // client production build needs to account for page hash, which is // injected directly in the page's html let pageHash = __VP_HASH_MAP__[pagePath.toLowerCase()] - if (!pageHash && pagePath.endsWith('_index.md')) { - pagePath = pagePath.slice(0, -9) + '.md' + if (!pageHash) { + pagePath = pagePath.endsWith('_index.md') + ? pagePath.slice(0, -9) + '.md' + : pagePath.slice(0, -3) + '_index.md' pageHash = __VP_HASH_MAP__[pagePath.toLowerCase()] } pagePath = `${base}assets/${pagePath}.${pageHash}.js`