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

Commit 4d0f882

Browse files
author
Rémi Becheras
committed
fix #20 - add a workaround for undefined export var
1 parent f9bec24 commit 4d0f882

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

node/ltnodeclient.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,12 @@ function sbRequire(require, resolve, path) {
9393
if(!getSB(path)) {
9494
if(path.match(/[\\\/]/) && fpath.extname(path) == ".js") {
9595
var sb = sandboxes[path.toLowerCase()] = context(path);
96+
var _cleanCode = cleanCode(fs.readFileSync(path));
97+
_cleanCode = ';var exports = module.exports;' + _cleanCode;
9698
moduleCache[path] = sb.module;
9799
prevModule = currentModule;
98100
currentModule = sb.module;
99-
vm.runInContext(cleanCode(fs.readFileSync(path)), sb, path);
101+
vm.runInContext(_cleanCode, sb, path);
100102
currentModule = prevModule;
101103
sb.module.loaded = true;
102104
} else {

0 commit comments

Comments
 (0)