Configuration

pageExtensions in Pages Router

Change recognized filename suffixes when colocating helpers with Pages routes. Apply the suffix to all relevant convention files and API handlers as well as ordinary pages; inventory the actual app before migration. This example is for a separate Pages-only fixture. Source: https://nextjs.org/docs/pages/api-reference/config/next-config-js/pageExtensions. Documentation-reviewed illustrative draft; installed declarations and runtime not verified.

Formal Syntax & Structure

nextjs syntaxnextjs
pageExtensions: string[]

Working Example

Example Snippetnextjs
// next.config.tsimport type {NextConfig} from 'next';const config:NextConfig={pageExtensions:['page.tsx','page.ts']};export default config;// pages/catalog.page.tsx// pages/_app.page.tsx// pages/_document.page.tsx (if used)// pages/api/stock.page.ts
Next.js Reference