Closed kzar closed 7 years ago
We no longer need this feature since @palant realised there's an easier way to achieve the same thing. If you create a sandbox for a module which exports its require
function you can then use that to require any other modules you need inside the sandbox. For example:
example.js
exports.require = require;
A different file
let SandboxedModule = require("sandboxed-module");
let requireInSandbox = SandboxedModule.require("example").require;
requireInSandbox("foo");
Hi,
Thanks for creating this library, very useful. Anyway I'm porting some unit tests to use it and found that I needed to make this small change. I needed to be able to share the module cache between SandBoxedModule instances. Any chance you could merge?
Thanks, Dave.
(CC @palant)