Skip to content

[Turbopack] [Pages] Hydration error (or double render) when using dynamic imports in _app.tsx #85370

@rtrembecky

Description

@rtrembecky

Link to the code that reproduces this issue

https://github.com/rtrembecky/next-turbopack-hydration-repro

To Reproduce

  1. Install the deps - pnpm i
  2. Start the app - pnpm dev
  3. Navigate to http://localhost:3000

Current vs. Expected behavior

Current behavior:

Image

Expected: No errors.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:29 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000
  Available memory (MB): 32768
  Available CPU cores: 10
Binaries:
  Node: 24.2.0
  npm: 11.4.0
  Yarn: 1.22.19
  pnpm: 9.15.9
Relevant Packages:
  next: 16.0.1-canary.2 // Latest available version is detected (16.0.1-canary.2).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A

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

Pages Router, Module Resolution, Turbopack

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

next dev (local), next build (local), Other (Deployed)

Additional context

Pinpointed broken versions:

  • canary: >= 15.1.1-canary.14, up to 16.0.1-canary.2
  • stable: >= 15.2.0

Working versions:

  • 15.1.1-canary.13
  • 15.1.6

Background:

Real world scenario:

  • On www.groupon.com, we use const Layout = Component.getLayout || DefaultLayout; in _app.tsx, where DefaultLayout is imported dynamically - it's not needed for a user that accesses only pages with custom layouts (defined on the page level via Page.getLayout).
    • -> We are getting hydration errors in dev when using Turbopack, and also production React minified errors (even though we haven't migrated build to Turbopack yet, so it might be a different issue).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Module ResolutionModule resolution (CJS / ESM, module resolving).Pages RouterRelated to Pages Router.TurbopackRelated to Turbopack with Next.js.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions