Skip to content

Dynamic import with suspense:true will disable ssr:false #39609

Description

@meotimdihia

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000
Binaries:
  Node: 16.16.0
  npm: 8.11.0
  Yarn: 1.22.15
  pnpm: 6.11.0
Relevant packages:
  next: 12.2.6-canary.0
  eslint-config-next: 12.2.5
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

Chrome 104.0.5112.79

How are you deploying your application? (if relevant)

yarn dev

Describe the Bug

Uncaught Error: window is not defined

    at updateDehydratedSuspenseComponent (react-dom.development.js?ac89:20662:1)
    at updateSuspenseComponent (react-dom.development.js?ac89:20362:1)
    at beginWork (react-dom.development.js?ac89:21624:1)
    at beginWork$1 (react-dom.development.js?ac89:27426:1)
    at performUnitOfWork (react-dom.development.js?ac89:26557:1)
    at workLoopSync (react-dom.development.js?ac89:26466:1)
    at renderRootSync (react-dom.development.js?ac89:26434:1)
    at performConcurrentWorkOnRoot (react-dom.development.js?ac89:25738:1)
    at workLoop (scheduler.development.js?bcd2:266:1)
    at flushWork (scheduler.development.js?bcd2:239:1)
    at MessagePort.performWorkUntilDeadline (scheduler.development.js?bcd2:533:1)

Expected Behavior

ssr: false should work.

Link to reproduction

It is too easy to reproduce.

To Reproduce

const WarningDomain = dynamic(
  () => import("@components/index/warning_domain"),
  { ssr: false, suspense: true }
)

It is related to this issue #36636.

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