Skip to content

v8 broken on Node 14Β #3830

@EvHaus

Description

@EvHaus

Describe the bug

I'm actively testing version 8 alpha and I'm seeing an issue. I'm using @tanstack/react-table version 8.0.0-alpha.26 in my Next.js app. It works fine in local dev mode (yarn dev) and builds work fine when I generate them via yarn build, but when deploying to Vercel the builds on Vercel fail with:

ReferenceError: performance is not defined
--
23:27:09.806 | at Object.getHeaderGroups (/vercel/path0/node_modules/@tanstack/table-core/build/cjs/utils.js:64:33)
23:27:09.807 | at DataTable (/vercel/path0/.next/server/pages/reports.js:749:37)
23:27:09.807 | at Hc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:64:191)
23:27:09.807 | at Kc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:66:253)
23:27:09.807 | at Z (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:89)
23:27:09.808 | at Lc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:73:98)
23:27:09.808 | at Nc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:72:306)
23:27:09.808 | at Z (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:217)
23:27:09.811 | at Lc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:73:98)
23:27:09.811 | at Kc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:67:131)

I tracked it down to the fact that my local environment runs Node 16 but Vercel probably runs Node 14 or less. I also think the code that triggers this failure might not be working as expected. The code in question is here:

if (opts.key && opts.debug) depTime = performance.now()

Both opts.key and opts.debug are both defined even when I don't have debug: true set. This is because debug is set to a function by react-table itself. I wonder if maybe it would be better to turn that off? Or find a different way to determine when performance.now() is run.

Your minimal, reproducible example

https://stackblitz.com/edit/nextjs-wyexvd?file=pages%2Findex.js

Steps to reproduce

  1. Create a Next.js app
  2. Add "@tanstack/react-table": "8.0.0-alpha.26" to the dependencies
  3. Add import {useTable} from 'react-table' to pages/index.js
  4. Use nvm to switch to Node 16
  5. Run npm run build -- note that it works
  6. Use nvm to switch to Node 14
  7. Run npm run build -- note that it fails

Expected behavior

react-table should work in Both Node 14 and Node 16

How often does this bug happen?

No response

Screenshots or Videos

No response

Platform

Windows WSL, but the issue is reproducible on Ubuntu as well

react-table version

8.0.0-alpha.26

TypeScript version

4.6.3

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions