xmtp / xmtp-js

XMTP client SDKs, content types, and other packages written in TypeScript
https://xmtp.org/docs
211 stars 40 forks source link

Resolve react-scripts ^5.0.0 incompatibility #169

Closed saulmc closed 10 months ago

saulmc commented 2 years ago

Context

Due to changes to polyfills in webpack v5, the node-localstorage dependency which relies on fs cannot be used with react-scripts ^5.0.0. The xmtp-js README therefore guides developers to use lower versions of react-scripts.

Problem

Developers whose apps require react-scripts ^5.0.0 cannot use xmtp-js. Although the requirement to use a lower version of this module usually isn't an issue when starting a new app, it can be prohibitively difficult to downgrade an existing app that was created using an incompatible react-scripts version.

Goal

Remove dependencies that are incompatible with webpack v5 and react-scripts ^5.0.0.

Potential solution

Use a LocalStorage polyfill that doesn't require the filesystem and keeps the data in memory.

rygine commented 10 months ago

check out our new docs on solving polyfill issues with webpack and react-scripts v5 here: https://xmtp.org/docs/faq#why-my-app-is-failing-saying-buffer-is-not-found