mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Fix up loading of freshly installed modules in Function node
This commit is contained in:
@@ -89,15 +89,13 @@ module.exports = function(RED) {
|
||||
}
|
||||
|
||||
function FunctionNode(n) {
|
||||
var libs = n.libs || [];
|
||||
n.modules = libs.map(x => x.spec).filter(x => (x && (x !== "")));
|
||||
RED.nodes.createNode(this,n);
|
||||
var node = this;
|
||||
node.name = n.name;
|
||||
node.func = n.func;
|
||||
node.ini = n.initialize ? n.initialize.trim() : "";
|
||||
node.fin = n.finalize ? n.finalize.trim() : "";
|
||||
node.libs = libs || [];
|
||||
node.libs = n.libs || [];
|
||||
|
||||
if (RED.settings.functionExternalModules === false && node.libs.length > 0) {
|
||||
throw new Error("Function node not allowed to load external modules");
|
||||
@@ -298,9 +296,9 @@ module.exports = function(RED) {
|
||||
if (vname && (vname !== "")) {
|
||||
sandbox[vname] = null;
|
||||
try {
|
||||
var spec = module.spec;
|
||||
var spec = module.module;
|
||||
if (spec && (spec !== "")) {
|
||||
var lib = RED.require(module.spec);
|
||||
var lib = RED.require(module.module);
|
||||
sandbox[vname] = lib;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user