securedeveloper / react-data-export

Export dataset in react.
https://securedeveloper.github.io/react-data-export/
MIT License
179 stars 198 forks source link

Warning: Module not found: Can't resolve '../xlsx' #122

Closed jurepetrovic closed 4 years ago

jurepetrovic commented 4 years ago

Hello,

Since the upgrade of all npm packages, I'm getting warning about ../xlsx file.

Compiled with warnings.

./node_modules/react-data-export/node_modules/tempa-xlsx/ods.js Module not found: Can't resolve '../xlsx' in 'D:\VSCode\ordermanager.git\node_modules\react-data-export\node_modules\tempa-xlsx'

I've seen some similar issues, but none of the solutions seems to work. I do not want to "eject" my react project - I'd like to keep react-scripts like they are.

Versions: "xlsx": "^0.15.4", "xlsx-style": "^0.8.13",

Any ideas anyone? thanks, Jure

Michael-Reich commented 4 years ago

Same, no solution currently

jurepetrovic commented 4 years ago

I read a little bit around and at the end decided to remove this dependency and make it simpler only with XLSX.

`

 exportFile() {
    // clean state
    this.removeData();
    // prepare new data
    this.transformData();
    /* convert state to workbook */
    const ws = XLSX.utils.aoa_to_sheet(this.state.data);
    const wb = XLSX.utils.book_new();
    XLSX.utils.book_append_sheet(wb, ws, "Trades");
    /* generate XLSX file and send to client */
    XLSX.writeFile(wb, "download_trades.xlsx")
};

`

Bilal-Abbas commented 4 years ago

I have the same problem. I was getting an error of "xlsx". I simply removed that with installing xlsx package but warning is still there. Any help regarding that warning ? My package.json has following packages

"react-data-export": "^0.6.0",
"tempa-xlsx": "^0.8.20",
"xlsx": "^0.15.6",
"xlsx-style": "^0.8.13"

and my config file has following code

node: {
    fs: "empty",
    net: "empty",
    tls: "empty",
  },
  externals: [{ "./cptable": "var cptable" }, { "./jszip": "jszip" }],

and if I tried to add vendor my code crashes

vendor: [
        'xlsx',
        'file-saver'
],

any help ?

gdhelp03 commented 3 years ago

solved for me

https://github.com/securedeveloper/react-data-export/issues/85#issuecomment-483662347