Module not found: Can't resolve 'fs' code example
Example 1: Error: Can't resolve 'fs' webpack
node: {
fs: 'empty'
}
Example 2: Module not found: Can't resolve 'react'
npm install react
npm install react-dom
Example 3: node require fs not found
module.exports = {
webpack: (config, { isServer }) => {
// Fixes npm packages that depend on `fs` module
if (!isServer) {
config.node = {
fs: 'empty'
}
}
return config
}
}