Skip to content

Instantly share code, notes, and snippets.

@badsyntax
Created January 5, 2021 08:59
Show Gist options
  • Save badsyntax/c9b8af0311c0deb23971e57a453177fd to your computer and use it in GitHub Desktop.
Save badsyntax/c9b8af0311c0deb23971e57a453177fd to your computer and use it in GitHub Desktop.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment