Skip to content

Commit

Permalink
Fix output path check for api pages
Browse files Browse the repository at this point in the history
  • Loading branch information
ofhouse committed Mar 19, 2021
1 parent 0357dce commit 7b85684
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7b85684

Please sign in to comment.