From 7b85684ee8acb548431eb3fbef55978051ea104a Mon Sep 17 00:00:00 2001 From: Felix Haus Date: Fri, 19 Mar 2021 21:22:43 +0100 Subject: [PATCH] Fix output path check for api pages --- packages/runtime/src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/runtime/src/index.ts b/packages/runtime/src/index.ts index 025c2292..61dd0def 100644 --- a/packages/runtime/src/index.ts +++ b/packages/runtime/src/index.ts @@ -1032,8 +1032,11 @@ export async function build({ [filePath: string]: FileFsRef; }; + const isApiPageReg = new RegExp( + `${serverOutputDirectory}\\/pages\\/api(\\/|\\.js$)` + ); const isApiPage = (page: string) => - page.replace(/\\/g, '/').match(/serverless\/pages\/api(\/|\.js$)/); + page.replace(/\\/g, '/').match(isApiPageReg); const canUsePreviewMode = Object.keys(pages).some(page => isApiPage(pages[page].fsPath)