React Table 8.7.4 breaks on NextJS 13
See original GitHub issueDescribe the bug
What’s the issue?
React table breaks on Next JS 13 ONLY on production builds. I can confirm that it happens both locally (next build && next start) and in the Vercel environment. My app is not using any SSR and only SSG pages.
It works fine on development but when we run a production build the react table throws an error. I did an initial investigation/debugging but I could not confirm if this is a problem with React Table itself, but I was able to reproduce it with a very simple demo.
Version/Environment
- NodeJS: Tested on Node
v14andv16.
@tanstack/react-table": "^8.7.4"
next": "13.0.7"
Investigation
I had a quick look at the issue and at the source code and it seems that the table getAllLeftColumns is returning undefined, and I did a quick debug to read all table states and it seems getAllColumns is also returning undefined. Sorry I didn’t investigate more as I am new to the source code, so I thought about posting it here to get some directions if this is a known issue or if there are any tips - otherwise I am more than happy to jump in and properly debug the issue.

How to reproduce?
- Clone the repository https://github.com/lucashfreitas/react-table-nextjs-issue
- Install the packages and run
npm run devand see that the table works just fine. - Run the build command to generate a production build:
npm run build. - Run the start command which runs the production-built version locally:
npm run start. - Notice that react table will break as per screenshot
Your minimal, reproducible example
https://github.com/lucashfreitas/react-table-nextjs-issue
Steps to reproduce
- Clone the repository https://github.com/lucashfreitas/react-table-nextjs-issue
- Install the packages and run
npm run devand see that the table works just fine. - Run the build command to generate a production build:
npm run build. - Run the start command which runs the production-built version locally:
npm run start. - Notice that react table will break as per screenshot
Expected behavior
I expected the react table to work with nextjs.
How often does this bug happen?
Often
Screenshots or Videos
No response
Platform
OS: MacOs, Linux (vercel environment) Browsers: Chrome/Firefox
react-table version
8.7.4
TypeScript version
4.9.4
Additional context
No response
Terms & Code of Conduct
- I agree to follow this project’s Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
Issue Analytics
- State:
- Created 9 months ago
- Reactions:1
- Comments:5

Top Related StackOverflow Question
@gempi @ekwoka @lucashfreitas
This is because Next.js 13 enabled SWCMinify by default, disabling it fixes the problem without having to use an older version of React Table.
Read my comment over here https://github.com/TanStack/table/issues/4610#issuecomment-1357263699 as this has already been discussed on in another issue.
I will close this issue as it’s a duplicate of #4604 and #4610 . Thanks @OmerWow