Some pain points:
- HMR is not always practical for server side development. For example HMR interferes with the initialisation of
prom-client
(and probably other libs), and there's no way to configure the HMR behaviour in Next.js (at time of writing).- "Interferes" meaning exceptions are thrown due to a "singleton" class being instantiated twice
- If you're using TypeScript, you'll need a completely seperate build process for server code:
- Generated server files are not part of the next build (ie don't exist within
.next
) - this is a pain when deploying or adding to a docker image - If you're consuming common code across the custom server and Next.js build, you're going to have 2 different compiled versions
- Generated server files are not part of the next build (ie don't exist within