Create Build with React and Next.js

Tiempo de lectura: < 1 minuto

Today we will learn how to create a build (with the folder) using React Next.js.

The first thing we need to do is go to the next.config.mjs file which by default has:

/** @type {import('next').NextConfig} */
const nextConfig = {};

export default nextConfig;

We will change it to:

/** @type {import('next').NextConfig} */
const nextConfig = {
    distDir: 'build'
};

export default nextConfig;

And now when we invoke the build command:

npm run build

It will generate the /build folder with the web content.

Leave a Comment