diff --git a/packages/meteor-env-dev/env.js b/packages/meteor-env-dev/env.js index 1e907ce482..42b69e0dca 100644 --- a/packages/meteor-env-dev/env.js +++ b/packages/meteor-env-dev/env.js @@ -1,15 +1,16 @@ if (typeof global === "object" && global.process) { + // We're on the server process = global.process; -} +} else { + if (typeof process !== "object") { + process = {}; + } -if (typeof process !== "object") { - process = {}; -} + if (typeof process.env !== "object") { + process.env = {}; + } -if (typeof process.env !== "object") { - process.env = {}; -} - -if (typeof process.env.NODE_ENV !== "string") { - process.env.NODE_ENV = "development"; + if (typeof process.env.NODE_ENV !== "string") { + process.env.NODE_ENV = "development"; + } } diff --git a/packages/meteor-env-prod/env.js b/packages/meteor-env-prod/env.js index 3b9374cb13..a0e3d475f4 100644 --- a/packages/meteor-env-prod/env.js +++ b/packages/meteor-env-prod/env.js @@ -1,15 +1,16 @@ if (typeof global === "object" && global.process) { + // We're on the server, just use the real `process` object. process = global.process; -} +} else { + if (typeof process !== "object") { + process = {}; + } -if (typeof process !== "object") { - process = {}; -} + if (typeof process.env !== "object") { + process.env = {}; + } -if (typeof process.env !== "object") { - process.env = {}; -} - -if (typeof process.env.NODE_ENV !== "string") { - process.env.NODE_ENV = "production"; + if (typeof process.env.NODE_ENV !== "string") { + process.env.NODE_ENV = "production"; + } }