distDir
你可以指定一个名称来用作自定义构建目录,以替代 .next
。
打开 next.config.js
并添加 distDir
配置:
next.config.js
module.exports = {
distDir: 'build',
}
现在如果你运行 next build
,Next.js 将使用 build
而不是默认的 .next
文件夹。
distDir
不应该离开你的项目目录。例如,../build
是一个无效的目录。
你可以指定一个名称来用作自定义构建目录,以替代 .next
。
打开 next.config.js
并添加 distDir
配置:
module.exports = {
distDir: 'build',
}
现在如果你运行 next build
,Next.js 将使用 build
而不是默认的 .next
文件夹。
distDir
不应该离开你的项目目录。例如,../build
是一个无效的目录。