Error in build file when using Vite- "r.BigInt is not defined"
Opened this issue · 3 comments
Bug Description
Uniswap widget works fine locally. After building, r.BigInt is not defined error appears.
Steps to Reproduce
use vite, install widget, verify it works locally, build file, preview build
I have the same problem as explained above, is there any update on this issue?
I'm also using Vite, the component works in development, the production build works fine, and when I try to open my deployed app, I also get this error:
TypeError: n.BigInt is not a function
I am experiencing the same error here. It turns out this is an issue with the target
or lib
config of your tsconfig.json
or vite.config.ts
as BigInt
support was added with es2020
. You can read more about it in this StackOverflow thread.
However, I did try all of the suggested fixes and still had no luck getting UniSwap to work in a build.
It's related to: GoogleChromeLabs/jsbi#70
Solution that worked for us was adding jsabi as dependency in our project and configuring vite to use cjs build:
resolve: {
alias: {
jsbi: resolve(__dirname, '.', 'node_modules', 'jsbi', 'dist', 'jsbi-cjs.js'),
},
},