Unverified Commit 59fb471b authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

Correct page search order (#6996)

This fixes a case where a user has a page named `next.js.js` and `next.js`.
parent 0e68d3c2
import path from 'path'
import fs from 'fs'
import path from 'path'
import { recursiveReadDir } from '../lib/recursive-readdir'
export function collectPages(
......@@ -36,9 +37,10 @@ function flatten<T>(arr: T[][]): T[] {
function getPossibleFiles(pageExtensions: string[], pages: string[]) {
const res = pages.map(page =>
[page]
.concat(pageExtensions.map(e => `${page}.${e}`))
pageExtensions
.map(e => `${page}.${e}`)
.concat(pageExtensions.map(e => `${path.join(page, 'index')}.${e}`))
.concat(page)
)
return flatten<string>(res)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment