Using Next.js is malpractice. I've never had a worse experience with a web framework (and I'm using that word extremely loosely here).
It's extremely messy. Hostile to debugging. Hostile to testing. Bad HMR. All this to offer us RPC and filesystem based routing (neither of which I even want in a framework).