Next.js datatables.net-react

Next.js datatables.net-react

mateuszzmateuszz Posts: 1Questions: 1Answers: 0

It is working fine when developer mode, but throwing an error while compiling to production:

npm run build

> nextjs@0.1.0 build
> next build

  ▲ Next.js 14.2.13

   Creating an optimized production build ...
 ✓ Compiled successfully
 ✓ Linting and checking validity of types    
 ✓ Collecting page data    
   Generating static pages (0/9)  [=   ]TypeError: nm.extend is not a function

The issue arises from the following code snippet:

import DataTable from "datatables.net-react";
import DT from "datatables.net-dt";

DataTable.use(DT);

Removing the line DataTable.use(DT); allows the compilation to complete successfully without any errors.

What to do?

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Can you create a minimal repo or a Stackbltiz showing the issue so I can take a look into it please? It sounds like the jQuery dependency might not be getting loaded in perhaps? I'd need to be able to see it to know for sure.

    Allan

Sign In or Register to comment.