Force NODE_ENV to production

I want to set the NODE_ENV flag to production in order to use the production version of react and related UI libraries for doing some profiling locally.
I don’t care about the negative performance of meteor in watch mode, I simply want to compare two versions of my UI code between each other, and I would like therefore to still use the meteor run mode.

However it seems that meteor run overrides the environment variable if I try to set it before running meteor. No matter what I do, it seems that meteor run always sets it to development.

Is there a way to tell meteor to pass NODE_ENV=“production” to node while in watch mode?

Thanks.

1 Like

try meteor --production

that minifies and bundles the JS and css, but it doesn’t set NODE_ENV to production, therefore you still get react’s dev build

NODE_ENV=production meteor --production

There is the --settings flag for Meteor.settings objects, which are useful in server and client environments. For environment variables, you can perhaps create a .env file with newlines such as export I_WANT_INFO='info_is_here', and then call source .env in terminal. Then reference process.env.I_WANT_INFO in code.

For production-specific if you use mup then you send commands in appropriate directory, or you supply --settings and --config.