Nguyen Dinh Khai
Posted on May 7, 2024
Here's a simple way to fix the "Module not found: Can't resolve 'pino-pretty'" and "Module not found: Can't resolve 'encoding'" errors in your NextJS or ReactJS project:
- Open your next.config.js file in the root folder of your project.
- Add this line config.externals.push('pino-pretty', 'encoding');
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
webpack: (config) => {
config.resolve.fallback = { fs: false, net: false, tls: false };
config.externals.push('pino-pretty', 'encoding');
return config;
},
};
module.exports = nextConfig;
💖 💪 🙅 🚩
Nguyen Dinh Khai
Posted on May 7, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.