2.
What is the command to build an application for production in Next.js?
build
yarn build
npm run build
next build
Correct: B, C, D
The correct command to build an application for production in Next.js is next build, which is the direct Next.js CLI command. However, you can also use npm run build or yarn build to achieve the same result, when you have defined a script in your package.json file that executes next build. The choice between npm and yarn depends on which package manager you are using for your project. The command compiles and optimizes the Next.js application, preparing it for deployment to a production server.