generateBuildId
Next.js 在 next build
期间生成一个 ID,用于标识正在提供的应用程序版本。应该使用相同的构建并启动多个容器。
如果为环境的每个阶段重建,则需要在容器之间生成一致的构建 ID。在 next.config.js
中使用 generateBuildId
命令
next.config.js
module.exports = {
generateBuildId: async () => {
// This could be anything, using the latest git hash
return process.env.GIT_HASH
},
}
这有帮助吗?