Having trouble with Meteor's environment vars


#1

I want to make a Makefile. I am using shell.js

var METEOR_COMMAND = process.platform === 'win32' ? 'meteor.bat' : 'meteor';
var METEOR_PATH = path.join(__dirname, 'meteor');

target.bundle = function (deviceId, url) {
  console.log('Build for OS: ' + process.platform + process.arch);
  cd(METEOR_PATH);

  var settings = JSON.stringify({ public: { deviceId: deviceId, url: url } });
  var environ = "NODE_ENV=production METEOR_SETTINGS='" + settings + "'"; 
  var options = "--once";

  return exec(environ + " " + METEOR_COMMAND + " " + options);
}

When I console.log my process.env.NODE_ENV within my Meteor.startup, it consistently says “development” despite passing “production” explicitly.

What’s the deal? Anyone experience this?


#2

Why would you want to set it to production? The Meteor command line tool sets it to development.


#3

It’s, to be honest, a pretty hacky work around to make it build an electron app, can’t find any better way


#4

Ok. The Meteor app is started by the .meteor/local/build/main.js file. If you execute this file, NODE_ENV is production by default already. You wouldn’t want to run your production app with meteor run.