Enhance Webpack configuration by adding fallbacks for Node.js core modules and integrating ProvidePlugin for Buffer and process support.

This commit is contained in:
chojuninengu 2025-04-29 10:56:55 +01:00
parent 3809375694
commit d5c86ce9ab
No known key found for this signature in database

View File

@ -21,9 +21,25 @@ const nextConfig = {
} }
config.resolve.fallback = { config.resolve.fallback = {
...config.resolve.fallback,
child_process: false, child_process: false,
process: false,
path: false,
fs: false,
os: false,
util: false,
stream: false,
buffer: require.resolve('buffer/'),
events: require.resolve('events/'),
}; };
config.plugins.push(
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser',
}),
);
return config; return config;
}, },
output: mode, output: mode,