Why the variable NODE_ENV is used in roadhog
951565664 opened this issue · comments
I set NODE_ENV. ...But its value is always equal to ‘production‘
"build": "cross-env NODE_ENV=production roadhog build",
"build:dev": "cross-env NODE_ENV=development roadhog build",
Why the variable NODE_ENV is used in roadhog, the variable NODE_ENV is often used to distinguish the test package and the formal package, if used in the roadhog, it will lead to users can not use NODE_ENV. Maybe you can use a custom variable like ROADHOG_NODE_ENV
It's a convention to set NODE_ENV to production
in the build process. Libraries like react, redux will be based on this to remove debugging code for the production environment.
e.g.
If (process.env.NODE_ENV === 'production') {
Console.log('debug code');
}
After build:
If (false) {
Console.log('debug code');
}
After uglify:
So, if you want to use environment variables to distinguish the environment, you can pick another name, such as ROADHOG_ENV.