错误截图: 无法解析 'process/browser':
我希望有人能帮我解决问题。由于Webpack 5的变化,我使用react-rewired在config-overrides.js中添加了回退,以处理polyfills。我已经安装了所有可以安装的依赖项,但仍然收到“process/browser”的错误提示。我不知道如何识别问题所在。
const webpack = require("webpack");
module.exports = function override(config) {
const fallback = config.resolve.fallback || {};
Object.assign(fallback, {
crypto: require.resolve("crypto-browserify"),
stream: require.resolve("stream-browserify"),
assert: require.resolve("assert"),
http: require.resolve("stream-http"),
https: require.resolve("https-browserify"),
os: require.resolve("os-browserify"),
url: require.resolve("url"),
zlib: require.resolve("browserify-zlib"),
fs: require.resolve("browserify-fs"),
process: require.resolve("process"),
buffer: require.resolve("buffer"),
net: require.resolve("net"),
});
config.resolve.fallback = fallback;
config.plugins = (config.plugins || []).concat([
new webpack.ProvidePlugin({
process: "process/browser",
Buffer: ["buffer", "Buffer"],
}),
]);
return config;
};
`fallback: { "crypto": require.resolve("crypto-browserify"), "http": require.resolve("stream-http"), "fs": require.resolve("browserify-fs"), "assert": require.resolve("assert"), "os": require.resolve("os-browserify"), "async_hooks": false, "express": false, },
}` - euføeniexternals: [{ 'express': { commonjs: 'express' } }]
- euføeni