Skip to content

Commit b42be17

Browse files
authored
Normalize optional catch-all fallback: true page params (vercel#17551)
This makes sure to normalize the params for optional catch-all routes on Vercel since for `fallback: true` pages the `[[...paramName]]` value will be provided for the undefined/root param which needs to be normalized. Tests have been added in vercel/vercel#5247 and were manually tested with the changes in this PR with https://github.com/ijjk/next-update-loader Fixes: vercel#17220 x-ref: vercel/vercel#5247
1 parent 782b7e4 commit b42be17

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/next/build/webpack/loaders/next-serverless-loader.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ const nextServerlessLoader: loader.Loader = function () {
8989
(!value || (
9090
Array.isArray(value) &&
9191
value.length === 1 &&
92-
value[0] === 'index'
92+
${
93+
''
94+
// fallback optional catch-all SSG pages have
95+
// [[...paramName]] for the root path on Vercel
96+
}
97+
(value[0] === 'index' || value[0] === \`[[...\${key}]]\`)
9398
))
9499
) {
95100
value = undefined

0 commit comments

Comments
 (0)