Open torhector2 opened 1 year ago
I have the same problem. It's failing to load in Storyboard for me.
my vite.config.ts which fixes all problems:
import { nodePolyfills } from "vite-plugin-node-polyfills";
{
plugins: [nodePolyfills()],
resolve: {
alias: {
jsbi: path.resolve(__dirname, "./node_modules/jsbi/dist/jsbi-cjs.js"),
"~@fontsource/ibm-plex-mono": "@fontsource/ibm-plex-mono",
"~@fontsource/inter": "@fontsource/inter",
},
},
build: {
commonjsOptions: {
transformMixedEsModules: true,
},
},
}
my vite.config.ts which fixes all problems:
import { nodePolyfills } from "vite-plugin-node-polyfills"; { plugins: [nodePolyfills()], resolve: { alias: { jsbi: path.resolve(__dirname, "./node_modules/jsbi/dist/jsbi-cjs.js"), "~@fontsource/ibm-plex-mono": "@fontsource/ibm-plex-mono", "~@fontsource/inter": "@fontsource/inter", }, }, build: { commonjsOptions: { transformMixedEsModules: true, }, }, }
This works.
Bug Description When you integrate the swap widget in a React app with Vite the widget won't work. There are 2 things happening:
Inspecting the console we can see this error log: "Uncaught Error: Could not parse fraction at Function.tryParseFraction (fraction.ts:38:11)"
If we follow the error we get to this line of code:
Steps to Reproduce Dev mode
Preview mode
Expected Behavior The widget should work fine with Vite
Environment Information Node v16.14.2 React: 18.2.0 Vite: 4.3.5 Uniswap/widgets: 2.51.2
Additional context This doesn't happen with Nextjs as I created a small project to test it.
I hope this issue can be addressed so that the @uniswap/widgets library can be used more effectively in Vite-based projects. If there are any temporary workarounds or further actions I can take on my end to alleviate these issues, I would greatly appreciate any guidance.
Thank you for your time and your work on this library.