Add `module` and `jsbi` to package.json
In a vite app, an issue occurs when both @uniswap/sdk-core and @uniswap/router-sdk are imported at the same time. A minimal repro can be found here: https://github.com/keithbro-imx/vite-uniswap-repro
In the browser, the following error is visible:
Uncaught TypeError: r.BigInt is not a function
r here is JSBI.
Using yalc locally I was able to point at a local build of this library, and I get the error:
Uncaught ReferenceError: require is not defined
Not exactly the same error, but this was resolved by adding the module option to the package.json. After this, both libraries could be imported and used at the same time.
I also added jsbi as a dependency (the same version constraints as core sdk for consistency), as this may also be contributing to the problem, though I wasn't able to confirm that.
Hi @adjkant and @tinaszheng - would be great to get your thoughts on this one - thank you!
We did some further testing of this fix by publishing the fix to an npm account, and observed the BigInt issue in the unfixed version, and no issue in the fixed version.
https://www.npmjs.com/package/@keithbro-imx/router-sdk?activeTab=versions
1.7.1 = unfixed 1.7.2 = fixed (this PR)
@tinaszheng Any chance you could take a look? 🙏
@jsy1218 Looks like you're active in this repo. Would you have a few mins to take a look at this PR and let us know if its suitable to to merge?