Skip to content
Merged
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
6 changes: 5 additions & 1 deletion apps/site/next.dynamic.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ const getDynamicRouter = async () => {
// Keeps the map of pathnames to filenames
const pathnameToFilename = new Map();

// Pre-compute the pages directory path to avoid Turbopack's overly broad
// file pattern analysis when using path.join() with dynamic segments
const pagesDirectory = join(process.cwd(), 'pages');

const websitePages = await getMarkdownFiles(
process.cwd(),
`pages/${defaultLocale.code}`
Expand Down Expand Up @@ -101,7 +105,7 @@ const getDynamicRouter = async () => {
// meaning that the route exists on the website and can be rendered
if (pathnameToFilename.has(normalizedPathname)) {
const filename = pathnameToFilename.get(normalizedPathname);
const filepath = join(process.cwd(), 'pages', locale, filename);
const filepath = normalize(`${pagesDirectory}/${locale}/${filename}`);

// We verify if our Markdown cache already has a cache entry for a localized
// version of this file, because if not, it means that either
Expand Down
Loading