securedeveloper / react-data-export

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

Module not found can't resolve 'fs' in node_modules\tempa-xlsx #168

Open Srivastava295 opened 2 years ago

Srivastava295 commented 2 years ago

We tried updating react-scripts from 4.0.3 to 5.0.0 with react-data-export 0.6.0 and xlsx 0.17.2, and when we try to build it fails with the error Module not found: Error: Can't resolve 'fs' in react-data-export\node_modules\tempa-xlsx

What fix needs to be applied to maintain react-scripts version 5.0.0? Thanks!

doraemonxxx commented 2 years ago

@Srivastava295 I have also the same problem. I tried to use older version but it is still the same. Do you have any workaround to solve this problem?

Thanks!

bryancalisto commented 2 years ago

I'm having this problem too. I made the build work by adding this lines to the 'resolve' field of webpack.config.js file (which is located in node_modules/react-scripts/config):

fallback: { "fs": false, "crypto": false },

imagen

Of course, this is a temporary fix.

The problem can be fixed definitively by replacing tempa-xlsx with xlsx in the package's source code. I'll try to make a pull request fixing it soon.

kaustubherttre commented 2 years ago

Any updates for the fix? Also will I be able to export if I add the above code?

bryancalisto commented 2 years ago

Any updates for the fix? Also will I be able to export if I add the above code?

I guess the package is not being maintained anymore. If you add the above code, it will work as long as you don't cause your webpack.config.js file to lose the added lines (e.g. by re-creating your node_modules). This may make it difficult to use this package in a continuous integration environment, because of the manual edit of webpack.config.js you have to make

tdammy92 commented 2 years ago

used this package somtimes last year and it worked, @bryancalisto your fix doesnt seems to be working anymore. any help,

aviyi commented 2 years ago

Any updates?

k4derdiarra commented 2 years ago

Any updates?

I switched from NPM to YARN and everything works perfectly. NPM has a lot of problems, try switching to YARN if you can. Maybe it can solve your problem

alkanpolat commented 1 year ago

Installing the xlsx package fixes it

npm i xlsx

jsoftwares commented 1 year ago

Hi guy, any fix on this bug yet?

Natnaelh commented 1 year ago

Adding "browser": { "fs": false, }, in the package.json file fixed it for me.

IamAhsanMani commented 10 months ago

Installing the xlsx package fixes it

npm i xlsx

@alkanpolat comment resolve my issue.

Pratiktarade commented 10 months ago

i try all above solution still facing same issue

pardo024 commented 8 months ago

Adding "browser": { "fs": false, }, in the package.json file fixed it for me.

resolve my issue.

sekersalih commented 1 week ago

I added the following dependencies to package.json:

"react-data-export": "^0.6.0" "xlsx": "^0.17.0" "tempa-xlsx": "0.0.1" Then, I deleted the node_modules and build folders.

After that, I ran these commands in order:

bash Kodu kopyala npm cache clear --force npm install npm run build This resolved the issue I was facing.

"tempa-xlsx": "0.0.1"