next.js: Generating static pages (2/4)Error: Minified React error - app directory Next js 13
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
 
Provide environment information
    Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Home
    Binaries:
      Node: 16.17.1
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 13.0.2
      eslint-config-next: 13.0.2
      react: 18.2.0
      react-dom: 18.2.0
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
I have tried to migrate an existing Next js application to use the app directory.
All is great except for two pages. For a certain page, I keep getting errors when building the app.
The error
> Build error occurred
Error: Export encountered errors on following paths:
        /search/page: /search
[=   ] info  - Generating static pages (2/4)Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
Error occurred prerendering page "/search". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
Expected Behavior
The app should build without errors.
Link to reproduction
https://github.com/mjad218/nextjs-13
To Reproduce
I have created this repo. It has the error I am talking about https://github.com/mjad218/nextjs-13
Just
- Clone the repo. 
git clone https://github.com/mjad218/nextjs-13 - Run 
npm install - Run 
npm run build - You will get some errors
 
About this issue
- Original URL
 - State: closed
 - Created 2 years ago
 - Comments: 17 (6 by maintainers)
 
I think we should separate the memory issue and the one originally reported for clarity. π
As confirmed with @huozhi, currently it is expected that
next/dynamicexpects to import a module object, hence dropping.then(m => m.default)is currently necessary forapp/. We are looking into if we can match the API with the one used inpages/for parity or if we want to keep recommending to not use.then(m => m.default).Memory issues are hard to debug, but if we get a reproduction of the repository, we will look into it. There might be open issues already that might help resolve your issue, so please have a look at those before opening a new one. Otherwise, just attach a repo and we will investigate. If itβs private, make sure to invite at least me and @jescalan. π
hmm. I can share a repo that contains most of the source code. It is a side project so I will make the repo private and may give you access to it.
.then(mod => mod.default)seemed to be the specific problem, if you remove those, can still build withnext/dynamic.Related PR: #41216