Next.js Dev Server patching
Unanswered
Sawfly parasitic wasp posted this in #help-forum
Sawfly parasitic waspOP
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. This is what i've tried:
After this I've downloaded the next source code (from https://github.com/vercel/next.js). After reading a lot of source code the only thing i found is Server.renderToResponseWithComponentsImpl(...), which is 1300 lines long function, purpose of which I cannot really understand. 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?
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. This is what i've tried:
if (req.method === "GET") {
await app.render(req, res, pathname, query);
} After this I've downloaded the next source code (from https://github.com/vercel/next.js). After reading a lot of source code the only thing i found is Server.renderToResponseWithComponentsImpl(...), which is 1300 lines long function, purpose of which I cannot really understand. 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?