nextConfig environment variables not working #77532
-
Summary
My next.config.mjs file has public environment variables, but theyre not showing up in the app. I have set PUBLIC, but still not getting anything. This is probably a stupid question, but I dont know what im overlooking. Thank you Additional informationNo response ExampleNo response |
Beta Was this translation helpful? Give feedback.
Answered by
timmypidashev
Mar 26, 2025
Replies: 1 comment
-
You missed the Corrected: /** @type {import('next').NextConfig} */
const nextConfig = {
output: "standalone",
transpilePackages: ["next-mdx-remote"],
images: {
unoptimized: true,
},
env: {
NEXT_PUBLIC_VERSION: process.env.NEXT_PUBLIC_VERSION,
NEXT_PUBLIC_ENVIRONMENT: process.env.NEXT_PUBLIC_ENVIRONMENT,
NEXT_PUBLIC_BUILD_DATE: process.env.NEXT_PUBLIC_BUILD_DATE,
NEXT_PUBLIC_GIT_COMMIT: process.env.NEXT_PUBLIC_GIT_COMMIT,
},
}
export default nextConfig; |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
lnlyct
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You missed the
process
argument. This should resolve your environment variables properly if you declared them.Corrected: