1

I currently have a React Rewired App with Typescript which is compiling but has 3 errors that I can't manage to resolve due to being from the node_modules folders.

Compiled with problems:X

ERROR in ./node_modules/@sentry/node/esm/integrations/utils/http.js 126:38-41

export 'URL' (imported as 'URL') was not found in 'url' (possible exports: Url, format, parse, resolve, resolveObject)


ERROR in ./node_modules/@sentry/node/esm/integrations/utils/http.js 127:39-42

export 'URL' (imported as 'URL') was not found in 'url' (possible exports: Url, format, parse, resolve, resolveObject)


ERROR in ./node_modules/@sentry/node/esm/transports/base.js 90:53-60

export 'URL' (imported as 'url') was not found in 'url' (possible exports: Url, format, parse, resolve, resolveObject)

The project is a Web3 project with smart contracts. I'm using hardhat, and I have seen that @sentry is a dependancy.

This is my current config-overrides.js:


/* eslint-disable node/no-extraneous-require */
/* eslint-disable node/no-unpublished-require */
const webpack = require("webpack");

module.exports = function override(config) {
  const fallback = config.resolve.fallback || {};
  Object.assign(fallback, {
    path: false,
    domain: false,
    console: false,
    zlib: false,
    crypto: false,
    stream: false,
    assert: false,
    http: false,
    https: false,
    os: false,
    constants: false,
    vm: false,
    fs: false,
    module: false,
    child_process: false,
    net: false,
    repl: false,
    async_hooks: false,
    tls: false,
    perf_hooks: false,
    util: false,
  });
  config.resolve.fallback = fallback;

  config.plugins = (config.plugins || []).concat([
    new webpack.ProvidePlugin({
      process: "process/browser",
      Buffer: ["buffer", "Buffer"],
    }),
  ]);
  return config;
};

Any idea on how to fix the issue?

Raül
  • 137
  • 3
  • 15

1 Answers1

0

The answer is over here https://stackoverflow.com/a/67298289/16124812, URL need not be imported.

For me removing statement import URL from "url"; solved the issue