Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Add module and jsbi to package.json #55

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

keithbro-imx
Copy link

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.

@keithbro-imx
Copy link
Author

Hi @adjkant and @tinaszheng - would be great to get your thoughts on this one - thank you!

@keithbro-imx
Copy link
Author

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)

@pano-skylakis
Copy link

@tinaszheng Any chance you could take a look? 🙏

@keithbro-imx
Copy link
Author

@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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants