In my index.js code, I've checked the value of process.env.NODE_ENV variable and expected it to be 'production', but on Heroku this variable is registering a value of 'development'.
I've read that Heroku sets this value to 'production' by default, but for some reason it's still registering as 'development', even when I explicitly set the value under Config Vars it still shows it's development. Below is the condition in my index.js file:
if (process.env.NODE_ENV === 'production') {
// serve production assets...
} else {
// serve development assets...
}
If I change the line to...
if (process.env.NODE_ENV === 'development') {
The production assets get served up just fine on Heroku.
Any ideas on how I may get process.env.NODE_ENV to register as 'production' on Heroku?
EDIT:
Within my webpack.js file I am doing this...
const env = process.env.NODE_ENV;
const config = {
mode: env || 'development'
};
module.exports = {
// some code...
...config, // 'development' or 'production' mode
// more code...
}
I did try hard-coding this value to 'production' like so...
mode: env || 'production'
But that had no effect.