Skip to content

Error occurred prerendering page "/_not-found" with pageExtensions option #65447

@Krasnopir

Description

@Krasnopir

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/misty-glade-yh92cc

To Reproduce

After update to 14.2.* version, when i use pageExtensions in next.config, i got an error while try to build my app

module.exports = {
  pageExtensions: ['page.tsx', 'page.ts'],
}

i have in my app folder all files with .page.tsx -

app:
- error.page.tsx
- global-error.page.tsx
- not-found.page.tsx
- layout.page.tsx
- page.page.tsx

Current vs. Expected behavior

Build app fail with pageExtentions option

✓ Linting and checking validity of types    
 ✓ Collecting page data    
   Generating static pages (0/8)  [=   ]
Error occurred prerendering page "/_not-found". Read more: https://nextjs.org/docs/messages/prerender-error

TypeError: Cannot read properties of undefined (reading 'clientModules')
    at /home/ui/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:23603
    at /home/ui/node_modules/next/dist/server/lib/trace/tracer.js:191:62
    at /home/ui/node_modules/next/dist/server/lib/trace/tracer.js:140:36
    at NoopContextManager.with (/home/ui/node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js:25:19)
    at ContextAPI.with (/home/node_modules/@opentelemetry/api/build/src/api/context.js:60:46)
    at NoopTracer.startActiveSpan (/home/ui/node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js:65:31)
    at ProxyTracer.startActiveSpan (/home/ui/node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js:36:24)
    at /home/ui/node_modules/next/dist/server/lib/trace/tracer.js:122:103
    at NoopContextManager.with (/home/ui/node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js:25:19)
    at ContextAPI.with (/home/ui/node_modules/@opentelemetry/api/build/src/api/context.js:60:46)
 ✓ Generating static pages (8/8)

> Export encountered errors on following paths:
	/_not-found/page: /_not-found

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr  4 14:39:20 UTC 2
  Available memory (MB): 15622
  Available CPU cores: 12
Binaries:
  Node: 20.12.2
  npm: 10.5.0
  Yarn: 1.22.19
  pnpm: N/A
Relevant Packages:
  next: 14.2.3 // Latest available version is detected (14.2.3).
  eslint-config-next: 14.2.3
  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)

Not sure

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

next build (local)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions