Воланд (Diabl)
Воланд (Diabl)
TTCTheo's Typesafe Cult
Created by Воланд (Diabl) on 5/16/2024 in #questions
Patching Next Dev Server
I want to patch next.js dev server to get component tree on server (e.g. list all client components or draw tree in of all components exist on the server vs on the client) At first i tried to step into .render function of NextServer using WebStorm debugger, but it does not now where to jump therefore just skips the app.render call. After this I've downloaded the next source code (from https://github.com/vercel/next.js). After reading a lot of source code i found Server.renderToResponseWithComponentsImpl(...), which is 1300 lines long function, purpose of which I cannot really understand, and renderToHTMLOrFlightImpl (which is part of app-render.tsx module), magic of which is even less clear. Maybe there are some resources like articles or docs on next.js internals that can be helpful? Or maybe my approach is wrong and I whould try to do this in a different way?
2 replies