网页
综合
更新时间 2026-09-23 00:00:00
distDir
自动蜘蛛
nextjs.org
正文约 927 字
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:
Now if you run next build Next.js will use build instead of the default .next folder.
Next.js takes ownership of distDir and will sometimes delete its contents. Point it at a directory used only by Next.js.
distDir is resolved relative to the directory holding your next.config.js, and may point to a dedicated directory inside the workspace that contains it. In a monorepo, an application at apps/web can build into ../.next.
To protect against data loss, Next.js refuses to use the directory and fails with an Invalid distDir error when distDir resolves outside the application and workspace, or when it is the application directory itself or one of its ancestors.
Last updated September 23, 2026
Subscribe to our newsletter
Stay updated on new releases and features, guides, and case studies.
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。