Skip to content

Instantly share code, notes, and snippets.

@szymonkorytnicki
Created November 8, 2022 07:44
Show Gist options
  • Save szymonkorytnicki/98678b127eba3283c4f5a70e774cfffd to your computer and use it in GitHub Desktop.
Save szymonkorytnicki/98678b127eba3283c4f5a70e774cfffd to your computer and use it in GitHub Desktop.
// works, get replaced in build time
const someVar = process.env.MY_VARIABLE;
// doesn't work! How should Next know how to replace it in build time?
function getVariable(name) {
return process.env[name];
}
const someVar = getVariable(MY_VARIABLE);
// try this!
console.log(process.env);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment