Just wondering if there is a flag that you can check on to see if Meteor is running in development mode or if it’s fully deployed?
If there isn’t something standard, what do you guys use to check?
Just wondering if there is a flag that you can check on to see if Meteor is running in development mode or if it’s fully deployed?
If there isn’t something standard, what do you guys use to check?
on the server process.env.NODE_ENV
will be set as “production” or “development”
use this jboulhous:dev, i have just published, which is a debugOnly package and will not be bundeled in production code.
meteor add jboulhous:dev
you will have Meteor.isDevelopment
set to true
in dev mode.
More info here.
hey thats great, thanks!
Is the package open source?
I am interested in learning how to put them together and this one seems like an easy one to learn from
That is awesomely simple!
haha thanks a lot for sharing.
edit, I installed your package, but it still shows 0 installs on atmosphere, what is with that?
If it works like you say it does
then you just did the whole Meteor community a favour . thanks mate
So if this is only packaged during development, that means Meteor.isDevelopment will be unset during production?
UPDATE: my version https://github.com/jamgold/isdevelopment
Exactly @jamgold, in production code Meteor.isDevelopment will be undefined and may cause errors in some runtimes, we could use _.result(Meteor, ‘isDevelopment’) to test, we could also make another package (not debugOnly package) that uses jboulhous:dev and that will do the job like :
Meteor.isDevelopment = !! _.result(Meteor, 'isDevelopment')
and the trick is done.
I must say that your version @jamgold is pretty cool.
Did you try if it works consistently over a period of time? I checked for process.env.NODE_ENV and sometimes it gave me “production” when it wasn’t.
On my development system it consistently was development
I guess that meteor sets NODE_ENV to production some where to avoid connect errors, though not sure.
You gotta use Meteor.isDevelopment
, you kitty cat.