1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Support loading external module sub path

Fixes #3023
This commit is contained in:
Nick O'Leary 2021-06-16 17:02:24 +01:00
parent 85dafc0b3c
commit aea5445495
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -70,10 +70,13 @@ function requireModule(module) {
e.code = "module_not_allowed";
throw e;
}
if (BUILTIN_MODULES.indexOf(module) !== -1) {
return require(module);
const parsedModule = parseModuleName(module);
if (BUILTIN_MODULES.indexOf(parsedModule.module) !== -1) {
return require(parsedModule.module);
}
if (!knownExternalModules[module]) {
if (!knownExternalModules[parsedModule.module]) {
const e = new Error("Module not allowed");
e.code = "module_not_allowed";
throw e;