NEXTJS Application error: a client-side exception has occurred (see the browser console for more information)

612 Views Asked by At

I am trying to build my application in nextjs, and I use exceljs library for my export function with specific design and styles. Everything works fine in development side and when I'm trying to run 'npm run build' and start the application,

I am having this error in my console "Uncaught (in promise) TypeError: Cannot call a class as a function".

It points out in this line of code: const workbook = new ExcelJS.Workbook();

When I tried to use xlsx library and change it to const workbook = XLSX.utils.book_new() it works fine, but I have already finished coding my whole function and it will be hard to start again from scratch using different library.

Can anyone help me with this?

I have tried changing target on my tsconfig to es6, esnext but still not working. I have also tried updating my typescript version to latest still no luck.

0

There are 0 best solutions below