custom-module: add support for standard module export syntax
This commit is contained in:
parent
abdee0b223
commit
3c6f8b9581
3 changed files with 32 additions and 29 deletions
|
|
@ -54,11 +54,14 @@ class OscServer {
|
|||
setTimeout, clearTimeout,
|
||||
setInterval, clearInterval,
|
||||
settings,
|
||||
options: customModule.slice(1, customModule.length)
|
||||
options: customModule.slice(1, customModule.length),
|
||||
module: {},
|
||||
}
|
||||
|
||||
try {
|
||||
mod = vm.runInContext(file, vm.createContext(context))
|
||||
var context = vm.createContext(context)
|
||||
mod = vm.runInContext(file, context)
|
||||
if (context.module.exports) mod = context.module.exports
|
||||
} catch(err) {
|
||||
console.error(err)
|
||||
return false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue