Skip to content

fix(swc): avoid treating Pages Router sitemap and robots routes as app entries - #96967

Open
RajeshKumar11 wants to merge 1 commit into
vercel:canaryfrom
RajeshKumar11:fix/pages-sitemap-turbopack-build
Open

fix(swc): avoid treating Pages Router sitemap and robots routes as app entries#96967
RajeshKumar11 wants to merge 1 commit into
vercel:canaryfrom
RajeshKumar11:fix/pages-sitemap-turbopack-build

Conversation

@RajeshKumar11

Copy link
Copy Markdown

What?

Prevents the SWC react_server_components transform from treating Pages Router routes named sitemap or robots (e.g., pages/sitemap.js) as App Router metadata entries.

Why?

When building a Pages Router site with Turbopack, pages named pages/sitemap.js or pages/robots.js exporting getStaticProps or getServerSideProps failed during build with "getStaticProps" is not supported in app/. The transform was matching these route names with a metadata regex without checking if the file actually resided inside app_dir.

How?

In ReactServerComponentValidator::assert_invalid_api, updated is_app_entry to verify that self.filepath is located inside self.app_dir before treating metadata route names (sitemap, robots, manifest, etc.) as App Router entries. Added an e2e test covering pages/sitemap.js with getStaticProps.

Fixes #96859

@RajeshKumar11
RajeshKumar11 force-pushed the fix/pages-sitemap-turbopack-build branch from 6e3680b to d30a55a Compare August 8, 2026 12:17
@RajeshKumar11
RajeshKumar11 force-pushed the fix/pages-sitemap-turbopack-build branch from d30a55a to 4a4c122 Compare August 8, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Turbopack build fails on pages-router files named sitemap/robots: "getStaticProps" is not supported in app/ (no app directory)

1 participant