hhurz / tableExport.jquery.plugin

jQuery plugin to export a html table to JSON, XML, CSV, TSV, TXT, SQL, Word, Excel, PNG and PDF
MIT License
984 stars 714 forks source link

XLSX export does not work #339

Closed arsrobota closed 2 years ago

arsrobota commented 2 years ago

Hello, If I import tableexport.jquery.plugin/libs/js-xlsx/xlsx.core.min then XLSX export fails with message Uncaught ReferenceError: XLSX is not defined. If I try importing xlsx/dist/xlsx.full.min instead, it fails again with message Uncaught ReferenceError: XLSX.utils is not defined. On the other hand Excel export works well. Do I miss something ? I use Bootstrap-Table 1.19.1 with tableexport.jquery.plugin 1.20.1 under Webpack 5.59.1.

Many thanks !

hhurz commented 2 years ago

Unfortunately, I can't really answer this question as I'm not a bootstrap expert. The "ReferenceError: XLSX is not defined" message indicates that the xlsx.core.min file could not be loaded. Is the directory path correct? Does the file exist? There is a xlsx test file (without bootstrap) that could help you to track down your issue.

arsrobota commented 2 years ago

Hi hhurz, thanks for your reply. The path to xlsx.core.min.js correct. I can export an XLSX file with your test page. Perhaps the problem is on webpack side...

arsrobota commented 2 years ago

Inspecting webpack console, I can see when I import tableexport.jquery.plugin/libs/js-xlsx/xlsx.core.min I get an Error: Can't resolve 'fs' in 'D:\symfony\gar\node_modules\tableexport.jquery.plugin\libs\js-xlsx'" -t "Webpack Encore"

hhurz commented 2 years ago

A little bit googling leeds to this webpack isssue. Perhaps it helps.

arsrobota commented 2 years ago

Thanks for the link. I also found this Webpack migration guide as an update. Unfortunately it looks like Webpack Encore does not support resolve.fallback.