Uniswap / widgets

widgets-uniswap.vercel.app
GNU General Public License v3.0
123 stars 175 forks source link

Widget doesn't work at all with React #634

Open joshschcom opened 2 months ago

joshschcom commented 2 months ago

Bug Description & Stps to reprouce Done everything to insert the widget in the docs on a plain React App. When you then start the React App you get the following error:

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

After trying multiple steps to somehow get it working, after installing craco and adding a webpack config:

const webpack = require("webpack");

module.exports = {
  webpack: {
    configure: (webpackConfig) => {
      webpackConfig.module.rules.forEach((rule) => {
        if (rule.use) {
          rule.use.forEach((loader) => {
            if (loader.loader === "source-map-loader") {
              loader.exclude = [
                /node_modules\/jsbi/,
                /node_modules\/node-vibrant/,
              ];
            }
          });
        }
      });
      webpackConfig.resolve.fallback = {
        assert: require.resolve("assert/"),
        http: require.resolve("stream-http"),
        https: require.resolve("https-browserify"),
        path: require.resolve("path-browserify"),
        fs: false,
      };
      webpackConfig.plugins.push(
        new webpack.ProvidePlugin({
          process: "process/browser",
        })
      );
      return webpackConfig;
    },
  },
};

We still get errors and the localhost shows us that nothing can be fetched for example the Tokenlist

Screenshot 2024-05-19 164921

Additional Context It also doesnt work with next with very similar errors, and downgrading doesnt work either

IsoBitzzz commented 2 months ago

Just pass it your own token list or download the one in that url and point at it locally. Says how in the docs.

That being said theres a million other issues so have fun with that lol

joshschcom commented 2 months ago

Just pass it your own token list or download the one in that url and point at it locally. Says how in the docs.

That being said theres a million other issues so have fun with that lol

The Token List is not the issue, yes of course I tried that but its just one of 187 Errors in the console. I highly recommend you create a new react project and try to embed the Widget.

VivekKadvani commented 1 month ago

Any solution for this widget bug??