This is definitely something wrong with configuration, probably some options like CustomRequire should be taken from this.options. My suggestion is to use merged options object (this.options with options) when it comes to strict and wrapper.
Also probably dirname is missing in typescript def.
These undocumented options are currently experimental and therefore not documented. They are used for the NodeVMResolver functionality, but I have not decided yet to make them official.
In the Typescript definitions we can see that
NodeVm.prototype.run
accepts only 3 optionsBut inside source code of this method we have: https://github.com/patriksimek/vm2/blob/ffa93989fbafb43b7a83633d1665c251eba6f8fb/lib/nodevm.js#L380-L386
This is definitely something wrong with configuration, probably some options like
CustomRequire
should be taken fromthis.options
. My suggestion is to use merged options object (this.options
withoptions
) when it comes tostrict
andwrapper
. Also probablydirname
is missing in typescript def.