Skip to content
This repository was archived by the owner on May 7, 2023. It is now read-only.

Added capability to match Windows dirs #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added capability to match Windows dirs
tobinbc committed Dec 9, 2021

Verified

This commit was signed with the committer’s verified signature.
xavimolloy Xavier Molloy
commit 73c0852ec4d29ab9c9a3287653c357c63b476920
5,991 changes: 5,985 additions & 6 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/lambda.js
Original file line number Diff line number Diff line change
@@ -35,7 +35,8 @@ const inPages = (pathEntry, pages) => {
return true;
}
const pathEntryRel = pathEntry
.replace(/^(.*?)\.next\/serverless\/pages/, "")
.replace(/^(.*?)\.next[\/\\]serverless[\/\\]pages/, "")
.replace(/\\/g,'/')
.replace(/\.js$/, "");
for (page of pages) {
if (pathEntryRel === page) {
9 changes: 8 additions & 1 deletion src/lambda.test.js
Original file line number Diff line number Diff line change
@@ -10,7 +10,14 @@ test("check inSSRPages with pages", async () => {
"/home/paul/work/next-aws-lambda-webpack-plugin/example/.next/serverless/pages/people/[name]/messages.js";
expect(inPages(pathEntry, SSRPages)).toEqual(false);
});

test("check inSSRPages with pages on Windows", async () => {
let pathEntry =
"D:\\projects\\elephant\\.next\\serverless\\pages\\people\\[name]\\profile.js";
expect(inPages(pathEntry, SSRPages)).toEqual(true);
pathEntry =
"D:\\projects\\elephant\\.next\\serverless\\pages\\people\\[name]\\messages.js";
expect(inPages(pathEntry, SSRPages)).toEqual(false);
});
test("check inSSRPages with no pages", async () => {
let pathEntry =
"/home/paul/work/next-aws-lambda-webpack-plugin/example/.next/serverless/pages/people/[name]/profile.js";