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?