table icon indicating copy to clipboard operation
table copied to clipboard

Next.js 15 build failure: Module parse failed for @tanstack/react-table

Open abdooo097 opened this issue 8 months ago • 1 comments

TanStack Table version

v8.21.2

Framework/Library version

Next.js v15.2.4

Describe the bug and the steps to reproduce it

What version of TanStack Table are you using?

@tanstack/react-table: [v8.21.2]

What version of Next.js are you using?

Next.js: 15.2.4

What is your issue?

When building a Next.js 15 project with @tanstack/react-table, the following error occurs:

Module parse failed: 'import' and 'export' may appear only with 'sourceType: module'

It seems that Next.js Webpack does not handle this package as an ESM module correctly.

Steps to Reproduce:

  1. Create a Next.js 15 project.
  2. Install @tanstack/react-table (npm install @tanstack/react-table).
  3. Use it in a component.
  4. Run npm run build.

Expected Behavior:

The build should succeed without errors.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

undefined

Screenshots or Videos (Optional)

Image

Do you intend to try to help solve this bug with your own PR?

None

Terms & Code of Conduct

  • [x] I agree to follow this project's Code of Conduct
  • [x] 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.

abdooo097 avatar Mar 26 '25 18:03 abdooo097

Don't import from src

KevinVandy avatar Mar 27 '25 13:03 KevinVandy