beamworks / react-csv-importer

Uploader + CSV parser + raw file preview + UI for custom user column mapping, all in one
https://www.npmjs.com/package/react-csv-importer
MIT License
231 stars 95 forks source link

Upgrade readable-web-to-node-stream for compatibility with Webpack 5 #54

Closed lsrugo closed 2 years ago

lsrugo commented 2 years ago

Webpack 5 stopped including polyfills for native node APIs. readable-web-to-node-stream v2 relies on the stream Node API which is no longer available. Can you upgrade the version of readable-web-to-node-stream in this package to v3 where they fixed this issue?

Relevant PR: https://github.com/Borewit/readable-web-to-node-stream/pull/298

unframework commented 2 years ago

Hey Levy, thanks for reporting this! Finally got around understanding the issue. Should be a quick fix, just need to test it locally first.

unframework commented 2 years ago

About to release the updated version but got bitten by this issue I think: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/57473/files#diff-2696281f8832b1227bb41483a7525a8ccd9399bb4b1704f69c8c54bb1346d8edL208. Should be a quick fix.

unframework commented 2 years ago

Released v0.5.2 with this fix, cheers!

bionboy commented 2 years ago

@unframework When installing v0.5.2 on a fresh create-react-app (v5.0.0), I am still encountering this error.

Relevant package versions:

I noticed that currently this repo isn't using webpack v5

Error readout:

Compiled with problems:X
ERROR in ./node_modules/readable-web-to-node-stream/node_modules/readable-stream/lib/_stream_readable.js 46:13-37

Module not found: Error: Can't resolve 'buffer' in '/Users/luke/github/curai/partner-portal-demo/partner-portal/node_modules/readable-web-to-node-stream/node_modules/readable-stream/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "buffer": require.resolve("buffer/") }'
    - install 'buffer'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "buffer": false }

ERROR in ./node_modules/readable-web-to-node-stream/node_modules/readable-stream/lib/_stream_writable.js 70:13-37

Module not found: Error: Can't resolve 'buffer' in '/Users/luke/github/curai/partner-portal-demo/partner-portal/node_modules/readable-web-to-node-stream/node_modules/readable-stream/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "buffer": require.resolve("buffer/") }'
    - install 'buffer'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "buffer": false }

ERROR in ./node_modules/readable-web-to-node-stream/node_modules/readable-stream/lib/internal/streams/buffer_list.js 74:15-32

Module not found: Error: Can't resolve 'buffer' in '/Users/luke/github/curai/partner-portal-demo/partner-portal/node_modules/readable-web-to-node-stream/node_modules/readable-stream/lib/internal/streams'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "buffer": require.resolve("buffer/") }'
    - install 'buffer'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "buffer": false }

ERROR in ./node_modules/safe-buffer/index.js 4:13-30

Module not found: Error: Can't resolve 'buffer' in '/Users/luke/github/curai/partner-portal-demo/partner-portal/node_modules/safe-buffer'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "buffer": require.resolve("buffer/") }'
    - install 'buffer'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "buffer": false }
unframework commented 2 years ago

Hey, thanks Luke, I realize that I never updated my demo sandbox to use Webpack v5 - would have caught this earlier! Will take a look in the next couple days.

unframework commented 2 years ago

So I just pushed out v0.6.0 which removed the readable-web-to-node-stream package as dependency. That means that any Node polyfills are no longer needed for this library, please let me know if it still complains about missing dependencies.