Skip to content

Commit

Permalink
use process module for require('process')
Browse files Browse the repository at this point in the history
Globals are annoying and add to client side bloat. If you want process,
just use the process module. Complain to node.js about their
inconsistent way to require things.
  • Loading branch information
defunctzombie committed Jan 27, 2013
1 parent 3693e42 commit 01e1cd8
Show file tree
Hide file tree
Showing 4 changed files with 274 additions and 462 deletions.
3 changes: 1 addition & 2 deletions client/require.js
Expand Up @@ -48,8 +48,7 @@ function require(name) {
req.main = module;
}

var process = {};
details.fn.call(window, window, module, module.exports, req, process);
details.fn.call(window, window, module, module.exports, req);
return module.exports;
}

Expand Down
4 changes: 3 additions & 1 deletion lib/bundler.js
Expand Up @@ -14,10 +14,12 @@ var client = require('../client');
// shims we provide by default for core modules
// any user specified shims will add to this (or override it)
var k_default_shims = {
'events': require.resolve('events-browserify'),
'events': require.resolve('../shims/events'),
'http': require.resolve('http-browserify'),
'child_process': require.resolve('../shims/child_process'),
'stream': require.resolve('../shims/stream'),
'process': require.resolve('process/browser'),
'util': require.resolve('../shims/util'),
};

/// @return {Boolean} true if [id] is a native module
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -24,7 +24,8 @@
"optimist": "0.3.4",
"required": "0.0.8",
"merge": "1.0.0",
"http-browserify": "0.1.2"
"http-browserify": "0.1.2",
"process": "0.5.0"
},
"devDependencies": {
"mocha": ">1.0.0",
Expand Down

0 comments on commit 01e1cd8

Please sign in to comment.