Skip to content

Routes are broken when the page extension contains only 'tsx'. #65040

@thecuvii

Description

@thecuvii

Link to the code that reproduces this issue

https://github.com/thecuvii/page-extensions-repro

To Reproduce

  1. Create a new TypeScript app.

  2. Set pageExtensions to ['tsx'] in next.config.js.

  3. Visiting localhost:3000 will result in an error page with the message: 'pageExtensions.map is not a function'.

CleanShot 2024-04-25 at 7 20 49@2x

  1. Set pageExtension to `['tsx', 'ts'] and the problem will be resolved.

Current vs. Expected behavior

The router works when the pageExtensions are set to ['tsx'].

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000
  Available memory (MB): 65536
  Available CPU cores: 10
Binaries:
  Node: 20.12.2
  npm: 10.5.0
  Yarn: N/A
  pnpm: 9.0.5
Relevant Packages:
  next: 14.2.3 // Latest available version is detected (14.2.3).
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.4.5
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Pages Router, Runtime

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

No response

NEXT-3244

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pages RouterRelated to Pages Router.RuntimeRelated to Node.js or Edge Runtime with Next.js.bugIssue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions