Setting a custom build directory

You can specify a name to use for a custom build directory to use instead of .next.

Open next.config.js and add the distDir config:

  1. module.exports = {
  2. distDir: 'build',
  3. }

Now if you run next build Next.js will use build instead of the default .next folder.

distDir should not leave your project directory. For example, ../build is an invalid directory.

Related

[

Introduction to next.config.js

Learn more about the configuration file used by Next.js.]($0b4bd5a3a6817758.md)