Replies: 1 comment 3 replies
-
Next.js is web framework. It gives you a set of tools, not limited to these, but for your question these are relevant:
This means that in Next.js you can write React code, including React Server Components in App Router, and Next.js is able to put together all of your code, into modules it can use to serve as described by your File system structure. To put together all of your code, a process known as transpiling/compiling your React (w/ TypeScript perhaps) code is carried out. The idea is to turn your code into code that Node.js and the browser can understand, and it uses React to generate HTML, and generates other assets needed to serve content on a given route, under the umbrella of Webpack or Turbopack. Next.js is able to do this for development or production environments, with minimal differences in behavior. Going from development to production, goes through a Build step, where Next.js is also able to pre-render certain routes. Once again, to do this, Next.js has configured Webpack or Turbopack to process your input code, to be used by the Next.js server. Webpack and Turbopack are configured to create import graphs, compile, minify, and write to static files, all of your JavaScript, CSS, etc. I feel like this is enough to prompt more questions? I am interesting in re-using my answer here, but I want it to be derived from genuine questions a developer might have. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I've been working with next for about 3 years now, but I still don't know exactly how it works under the hood (at the moment I'm still working on version 12 of nextjs). I would like to know about two things. The first is about how and what the nextjs code itself does, what basic things it consists of, exactly how it runs on nodejs, how the collector (webpack and turbopack) is involved, etc.. The second thing is how exactly the dev and prod builds are arranged, what is the structure of the build and why is it exactly the same, how are all these files in the next package related to each other, etc. I understand that these are very difficult and at the same time basic questions, but I have not found an answer to them anywhere, please help with this.
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions