Using NextJS, you can create a build ID according to the documentation: https://nextjs.org/docs/app/api-reference/next-config-js/generateBuildId
It can also be obtained according to the latest git version: https://www.npmjs.com/package/next-build-id
But the question is: how do I read this build ID? I want to display it inside the window console.
I haven't tested it, but I think you could try the old way of passing the
env
variable via theenv
key in the configuration (I guess it's deprecated now, but it should still work) like this:Will be provided later as
process.env.BUILD_ID_ENV
To use it in a client component you may have to name it
NEXT_PUBLIC_BUILD_ID_ENV
, not sure.