Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Commit

Permalink
fix #20 - add a workaround for undefined export var
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémi Becheras committed Nov 28, 2016
1 parent f9bec24 commit 4d0f882
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion node/ltnodeclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,12 @@ function sbRequire(require, resolve, path) {
if(!getSB(path)) {
if(path.match(/[\\\/]/) && fpath.extname(path) == ".js") {
var sb = sandboxes[path.toLowerCase()] = context(path);
var _cleanCode = cleanCode(fs.readFileSync(path));
_cleanCode = ';var exports = module.exports;' + _cleanCode;
moduleCache[path] = sb.module;
prevModule = currentModule;
currentModule = sb.module;
vm.runInContext(cleanCode(fs.readFileSync(path)), sb, path);
vm.runInContext(_cleanCode, sb, path);
currentModule = prevModule;
sb.module.loaded = true;
} else {
Expand Down

0 comments on commit 4d0f882

Please sign in to comment.