@sentry库中的错误URL在React Rewired应用程序中
我目前有一个带有打字稿的React Rewired应用程序,该应用程序正在编译,但由于来自Node_modules文件夹而无法解决的3个错误。
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)
该项目是带有智能合约的Web3项目。我正在使用Hardhat,我已经看到@Sentry是依赖性。
这是我当前的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;
};
关于如何解决问题的任何想法?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
答案在这里 https://stackoverflow.com/a/a/a/67298289/16124812,
URL无需进口。
对我而言,从“ url”中删除陈述导入URL;解决了问题
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