Skip to content
This page is also available as Markdown at /docs/13/pages/api-reference/next-config-js/distDir.md. For an index of Next.js 13 Pages Router documentation, see /docs/13/pages/llms.txt.
You are currently viewing the Pages Router documentation for version 13 of Next.js.

distDir

Last updated June 28, 2023

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:

next.config.js
module.exports = {
  distDir: 'build',
}

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.

Was this helpful?

supported.