Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bug fix for module.exports.

  • Loading branch information...
commit f6e70cbb2c4df0338a3f2845f7b662e022305db7 1 parent f779e2a
Mikito Takada authored
Showing with 3 additions and 4 deletions.
  1. +2 −3 index.js
  2. +1 −1  package.json
View
5 index.js
@@ -18,15 +18,14 @@ function runInContext(filename, sandbox) {
content = stripBOM(content).replace(/^\#\!.*/, '');
// emulate require()
- var self = { exports: {} };
for (var k in global) {
sandbox[k] = global[k];
}
sandbox.require = require;
sandbox.__filename = filename;
sandbox.__dirname = path.dirname(filename);
- sandbox.module = self;
- sandbox.exports = self.exports;
+ sandbox.exports = {};
+ sandbox.module = sandbox;
sandbox.global = sandbox;
vm.runInNewContext(content, sandbox);
View
2  package.json
@@ -1,7 +1,7 @@
{
"name": "requireincontext",
"description": "Wrapper to require() js files in a custom context",
- "version": "0.0.1",
+ "version": "0.0.2",
"author": "Mikito Takada <mixu@mixu.net>",
"keywords": ["require"],
"repository": "git://github.com/mixu/requireincontext",
Please sign in to comment.
Something went wrong with that request. Please try again.