NextJS 12 and webpack 5 unknown property ‘fs’

I have upgraded from Next10 to Next12 (webpack5), also from React16 to React17. This is how our next.config.js looks like

next config here

When running a dev server this error comes up and I’m not sure how to work around it:

error on dev server

If I remove the fs: 'empty' from the config next12 does not seem to find other files in their respective location:

error when remove fs

Part of the package.json I believe its relevant to this looks as follow:

package json