cosmjs icon indicating copy to clipboard operation
cosmjs copied to clipboard

CosmJS cannot be used with CRA/react-scripts version 5 (Webpack 5)

Open webmaster128 opened this issue 2 years ago • 4 comments

When upgrading react-scripts from v4 to v5, you also get a webpack v4 to v5 upgrade. In Webpack 5 a bunch of modules need to be configures manually. CosmJS lists the required condiguration here: https://github.com/cosmos/cosmjs#webpack-configs.

However, since Create React App/react-scripts don't allow you to easily create your own webpack 5 config, this does not work together.

webmaster128 avatar Mar 12 '23 17:03 webmaster128

Did you find any option to not use crypto-browserify, stream-browserify and make cosmjs run?

mrakus-sofomo avatar Mar 29 '23 10:03 mrakus-sofomo

Given the responses in https://twitter.com/simon_warta/status/1634969846676078592 I assume CRA is pretty much dead and folks use different frameworks anyways.

webmaster128 avatar Mar 29 '23 10:03 webmaster128

@webmaster128 However, it seems to me that this does not solve the problem. Let's imagine a situation in which we have a package that is used by our customers. If I want to use @cosmjs, then I have to require each client to install polyfills.

mrakus-sofomo avatar Mar 29 '23 11:03 mrakus-sofomo

Nope, you just have to tell Webpack to not include those packages. This is how things are supposed to work. require("not-found") just throws at runtime and CosmJS is fine with that as there are different implementations.

webmaster128 avatar Mar 29 '23 11:03 webmaster128