After upgrading from Next10 to Next12 (webpack5) and from React16 to React17, our next.config.js
file now looks like this:
const config = {
webpack: (config, { isServer, buildId }) => {
// Fixes npm packages that depend on `fs` module
config.node = {
fs: 'empty',
}
However, when running a development server, the following error occurs and I'm unsure how to resolve it:
ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration[0].node has an unknown property 'fs'. These properties are valid:
object { __dirname?, __filename?, global? }
-> Options object for node compatibility features.
- configuration[1].node has an unknown property 'fs'. These properties are valid:
object { __dirname?, __filename?, global? }
-> Options object for node compatibility features.
at validate (C:\Users\Alvaro Lamadrid\Documents\origin\origin-dollar\dapp\node_modules\next\dist\compiled\schema-utils3\index.js:1:150822)