Use `netlifyConfig.build.environment` instead of `process.env`
Closed this issue · 1 comments
ehmicky commented
Inside plugins, environment variables should be read using process.env
but modified using netlifyConfig.build.environment
. Modifying process.env
works but has been deprecated.
For example:
module.exports = {
onPreBuild: ({netlifyConfig}) => {
// ...
netlifyConfig.build.environment[key] = process.env[definition];
}
};
Doing so will also automatically print a log message, which removes the need for:
bento-codeing commented
Indeed, it's much better if I can have something that does the same job, that is not depreciated and that avoids me to manage the logs.
Once again, thank you for your feedback 😁
See correction.