Subject: Webpack Error - UnhandledSchemeError: Reading from "node:child_process"
Unanswered
Allegheny mound ant posted this in #help-forum
Allegheny mound antOP
I'm encountering an issue with my Next.js project and would appreciate any guidance to resolve it. I've configured my Next.js project with webpack, and I'm encountering the mentioned error related to the "node:child_process" module. The error suggests that reading from "node:child_process" is not handled by plugins. I've attempted to exclude the 'fs' module when bundling for the client, but the issue persists.
code:
node:child_process
Module build failed: UnhandledSchemeError: Reading from "node:child_process" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.code:
/** @type {import('next').NextConfig} */
const webpack = require('webpack');
const nextConfig = {
images: {
domains: [
...
],
remotePatterns: [
{
protocol: 'http',
hostname: 'localhost',
port: '33400',
pathname: '',
},
{
protocol: 'http',
hostname: 'localhost',
port: '50000',
pathname: '',
},
{
protocol: 'https',
hostname: 'images.pexels.com',
port: '',
pathname: '/photos/**'
}
]
},
webpack: (config, { isServer }) => {
config.plugins.push(
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
})
);
// Exclude the 'fs' module when bundling for the client (browser)
if (!isServer) {
config.externals = config.externals || {};
config.externals['node:fs'] = require.resolve('node-fetch');
config.resolve.fallback = {
fs: false,
};
}
return config;
}
};
module.exports = nextConfig;1 Reply
Allegheny mound antOP
nvrm fiixed it lol