Flag for development mode?

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”

1 Like

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.

6 Likes

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 :smile:

1 Like

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?

1 Like

If it works like you say it does
then you just did the whole Meteor community a favour . thanks mate

3 Likes

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

2 Likes

Thank you @Murwade @cstrat.

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.

1 Like

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.

1 Like

You gotta use Meteor.isDevelopment, you kitty cat.