Ben
Ben

Reputation: 254

What does NextJS .prepare() actually do?

When running nextjs with a custom server, what does .prepare() called on the next application do?

Upvotes: 5

Views: 5943

Answers (2)

BAMIDELE ISAAC
BAMIDELE ISAAC

Reputation: 41

it does 5 things in this order in an async/await fashion

  1. Verify TypeScript Setup
  2. load Custom Routes
  3. add ExportPathMap to Routes Makes next export exportPathMap work in development mode. So that the user doesn't have to define a custom server reading the exportPathMap
  4. start hotReloader
  5. records telemetry [source code]

Upvotes: 4

MoHo
MoHo

Reputation: 2593

It prepare or make the next.js code ready to use another server (In their example express) for handling SSR.

Upvotes: 1

Related Questions