使用 NODE ENV 進行客戶端環境檢測

從 Meteor 1.3 開始,Meteor 現在預設在客戶端上公開 NODE_ENV 變數。

if (Meteor.isClient) {
  Meteor.startup(function () {
    if(process.env.NODE_ENV === "testing"){
      console.log("In testing...");
    }
    if(process.env.NODE_ENV === "production"){
      console.log("In production...");
    }
  });
}