next.js: Upgrading from 13.3.1 to ^13.4.4 causes react error "Warning: Invalid hook call."

Verify canary release

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

Provide environment information

To see a list of supported npm commands, run:
  npm help
    Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Pro
    Binaries:
      Node: 18.14.2
      npm: 9.5.0
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 13.3.1
      eslint-config-next: 13.3.1
      react: 18.2.0
      react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

Dynamic imports (next/dynamic)

Link to the code that reproduces this issue or a replay of the bug

n\a

To Reproduce

Upgrading from next 13.3.1 to ^13.4.4. Start dev app. Open page with react components

Describe the Bug

In my nextjs app i use a React components. which is located in another lib (with node_modules). I import react app in next dynamically, after that i start next app (next dev) and open page with this react component and i get error image I can’t use canary relis because i use @storybook/nextjs@7.0.18

Expected Behavior

The app starts normally

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 7
  • Comments: 17 (1 by maintainers)

Most upvoted comments

I have the same issue, and found that if I use code transpiled as esm library from node_modules - it doesn’t work. So if I copy component sources to project - works well