Skip to content

Commit

Permalink
Merge pull request #4688 from Rotzbua/remove_import_polyfill
Browse files Browse the repository at this point in the history
fix(polyfill): remove import module polyfill
  • Loading branch information
knolleary committed May 13, 2024
2 parents e55ebde + 20d2450 commit cf26209
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions packages/node_modules/@node-red/registry/lib/externalModules.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ let installEnabled = true;
let installAllowList = ['*'];
let installDenyList = [];

let IMPORT_SUPPORTED = true;
const nodeVersionParts = process.versions.node.split(".").map(v => parseInt(v));
if (nodeVersionParts[0] < 12 || (nodeVersionParts[0] === 12 && nodeVersionParts[1] < 17)) {
IMPORT_SUPPORTED = false;
}

function getInstallDir() {
return path.resolve(settings.userDir || process.env.NODE_RED_HOME || ".");
Expand Down Expand Up @@ -110,18 +105,6 @@ function requireModule(module) {
return require(moduleDir);
}
function importModule(module) {
if (!IMPORT_SUPPORTED) {
// On Node < 12.17 - fall back to try a require
return new Promise((resolve, reject) => {
try {
const mod = requireModule(module);
resolve(mod);
} catch(err) {
reject(err);
}
});
}

if (!registryUtil.checkModuleAllowed( module, null,installAllowList,installDenyList)) {
const e = new Error("Module not allowed");
e.code = "module_not_allowed";
Expand Down

0 comments on commit cf26209

Please sign in to comment.