-
Notifications
You must be signed in to change notification settings - Fork 299
Requiring a native module twice, fails #29
Comments
an other version of the problem: works: const NodeVM = require('vm2').NodeVM;
const vm = new NodeVM({
require: true,
requireExternal: true
});
vm.run("require('deasync')", __filename); does not work: require('deasync');
const NodeVM = require('vm2').NodeVM;
const vm = new NodeVM({
require: true,
requireExternal: true
});
vm.run("require('deasync')", __filename); Exception:
does not work: const NodeVM = require('vm2').NodeVM;
const vm = new NodeVM({
require: true,
requireExternal: true
});
vm.run("require('deasync')", __filename);
const vm2 = new NodeVM({
require: true,
requireExternal: true
});
vm2.run("require('deasync')", __filename); Exception:
|
Thanks for the report, both failures are cause by |
Ok. Here are some thoughts:
|
Yes, vm2 uses multi-context internally. This is definitely the core of the problem. It might be also somehow connected with #22 (loading a buffer in new context breaks buffer in original context). |
Fixed in 3.0. |
When I try to load a certain native module twice I get a strange exception.
Here's a minimal example, which shows the problem. (Requires the npm module 'deasync' to run).
The text was updated successfully, but these errors were encountered: