mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
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.
37 lines
838 B
JavaScript
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];
|
|
}
|
|
}
|