Uniswap / smart-order-router

GNU General Public License v3.0
413 stars 420 forks source link

Move JSBI to a direct dependency #191

Open kevjin opened 1 year ago

kevjin commented 1 year ago
hfa0 commented 1 year ago

did you manage to fix the issue with rollup?

facing same issue.

kevjin commented 1 year ago

iirc we did a weird hack where we did a find and replace after the vite build, to fix the JS

hfa0 commented 1 year ago

the vite build step optimizes the pre-build uniswap modules and messes up with the imports. not sure if the peer dependency is the real issue. but I created a vite.config that handles the import in dev and prod env.

const config = defineConfig({
  optimizeDeps: {
    exclude: ['jsbi'],
    include: ['@uniswap/universal-router-sdk > jsbi'],
  },
  build: {
    commonjsOptions: {
      requireReturnsDefault: (e) => e.includes('jsbi')
    },
  },
...
});