Files
meteor/packages/modules/process.js
Ben Newman 34b0237364 Avoid api.export("process") in modules package.js.
Declaring a package-local variable called `process` in the `modules`
package causes uglify-js not to replace `process.env.NODE_ENV` with a
string literal value in any `node_modules` contained by the `modules`
package, which causes React Dev Tools to display a warning.
2017-08-14 22:32:19 -04:00

37 lines
838 B
JavaScript

if (! global.process) {
try {
// The application can run `npm install process` to provide its own
// process stub; otherwise this module will provide a partial stub.
global.process = require("process");
} catch (missing) {
global.process = {};
}
}
var proc = global.process;
if (Meteor.isServer) {
// Make require("process") work on the server in all versions of Node.
meteorInstall({
node_modules: {
"process.js": function (r, e, module) {
module.exports = proc;
}
}
});
} else {
proc.platform = "browser";
proc.nextTick = proc.nextTick || Meteor._setImmediate;
}
if (typeof proc.env !== "object") {
proc.env = {};
}
var hasOwn = Object.prototype.hasOwnProperty;
for (var key in meteorEnv) {
if (hasOwn.call(meteorEnv, key)) {
proc.env[key] = meteorEnv[key];
}
}