xmtp / xmtp-js

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

Bug: React production build fails #309

Closed krivochenko closed 10 months ago

krivochenko commented 1 year ago

Describe the bug

Currently xmtp-js has "@noble/secp256k1": "^1.5.2" in dependencies. In process of transpiling this package there is a known issue. This issue the same as described. This is another package of the same owner.

Commonly used workaround by redefine browserList to late versions of browsders reduces cover of supported browsers to 30%.

In late releases owner fixed this code. So, maybe we could use it?

Expected behavior

XMTP does not fail on React production build.

Steps to reproduce the bug

  1. Define browserList
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
    }
  2. npm run build
  3. server -s build
jhaaaa commented 1 year ago

Thank you for taking the time to file this bug report @krivochenko! I'm assigning this to a developer for further investigation.

jhaaaa commented 1 year ago

@neekolas Might this be something we want to include in v8? Also, I'm not sure of the severity level - might you be able to help with that, please and thank you!

cc: @rygine

neekolas commented 1 year ago

So, to summarize the issue:

One of our dependencies uses BigInts. They are a standard feature in newer browsers. The particular way the library uses BigInt does not work with polyfills of BigInt.

Some client applications are using a bundler/transpiler that is polyfilling BigInt to support older browsers, but breaking the dependency along the way.

One possible solution is for us to recommend that developers using xmtp-js define a browserlist in their own app's package.json to tell their misbehaving bundler to target only new enough browsers that the polyfill is not needed. I'd be fine with that solution, and it does seem like we can do more to communicate that xmtp-js is not compatible with BigInt polyfills.

github-actions[bot] commented 10 months ago

:tada: This issue has been resolved in version 11.2.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] commented 10 months ago

:tada: This issue has been resolved in version 11.3.0-beta.13 :tada:

The release is available on:

Your semantic-release bot :package::rocket: