Not working in Next 12.2.5
briannelson95 opened this issue · comments
I see that this was close but I'm still getting this error with Next. Was there a fix? If so what was the fix?
Originally posted by @briannelson95 in #80 (comment)
Here is a replica of this issue
https://stackblitz.com/edit/nextjs-f4cr36?file=pages/index.js
I have the same problem - I tried hacking with webpack's config following a suggestion I found somewhere, but this didn't really get me anywhere:
const nextConfig = {
reactStrictMode: true,
webpack: (
config,
{ buildId, dev, isServer, defaultLoaders, nextRuntime, webpack }
) => {
config.externals = [
"child_process",
"dns",
"fs",
"net",
"tls",
"http2"
]
config.resolve.fallback = {
url: require.resolve("url"),
fs: require.resolve("graceful-fs"),
buffer: require.resolve("buffer"),
stream: require.resolve("stream-browserify"),
};
config.plugins.push(
new webpack.ProvidePlugin({
process: "process/browser",
Buffer: ["buffer", "Buffer"],
}),
new webpack.NormalModuleReplacementPlugin(/node:/, (resource) => {
const mod = resource.request.replace(/^node:/, "");
switch (mod) {
case "buffer":
resource.request = "buffer";
break;
case "stream":
resource.request = "readable-stream";
break;
default:
throw new Error(`Not found ${mod}`);
}
}),
);
config.ignoreWarnings = [/Failed to parse source map/];
return config
},
}
module.exports = nextConfig
I closed the other issue because there was no response for a reproduction, I'm investigating the issue and without any fix for now. Trying to hack some things inside next.js but with the same result, as soon as I get any fix will post it here!
Sorry for the troubles!
Hello! A quick update, this weekend I'm going to work on this package now that I have more time and fix the related issues 🙌