Skip to content

Commit

Permalink
Ensure index GSP data is available at correct path (#5336)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Oct 27, 2020
1 parent f8abcbc commit fa8e1e7
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/now-next/src/index.ts
Expand Up @@ -1724,7 +1724,9 @@ export const build = async ({
if (nonDynamicSsg || isFallback) {
outputPathData = outputPathData.replace(
new RegExp(`${escapeStringRegexp(origRouteFileNoExt)}.json$`),
`${routeFileNoExt}.json`
`${routeFileNoExt}${
origRouteFileNoExt === '/index' ? '/index' : ''
}.json`
);
}

Expand Down
42 changes: 42 additions & 0 deletions packages/now-next/test/fixtures/00-i18n-support/now.json
Expand Up @@ -385,6 +385,48 @@
"path": "/fr/not-found/fallback/first",
"status": 200,
"mustContain": "gsp page"
},

{
"path": "/_next/data/testing-build-id/en-US/index.json",
"status": 200,
"mustContain": "\"locale\":\"en-US\""
},
{
"path": "/_next/data/testing-build-id/en/index.json",
"status": 200,
"mustContain": "\"locale\":\"en\""
},
{
"path": "/_next/data/testing-build-id/fr/index.json",
"status": 200,
"mustContain": "\"locale\":\"fr\""
},
{
"path": "/_next/data/testing-build-id/nl/index.json",
"status": 200,
"mustContain": "\"locale\":\"nl\""
},

{
"path": "/_next/data/testing-build-id/en-US/gsp.json",
"status": 200,
"mustContain": "\"locale\":\"en-US\""
},
{
"path": "/_next/data/testing-build-id/en/gsp.json",
"status": 200,
"mustContain": "\"locale\":\"en\""
},
{
"path": "/_next/data/testing-build-id/fr/gsp.json",
"status": 200,
"mustContain": "\"locale\":\"fr\""
},
{
"path": "/_next/data/testing-build-id/nl/gsp.json",
"status": 200,
"mustContain": "\"locale\":\"nl\""
}
]
}

0 comments on commit fa8e1e7

Please sign in to comment.