From 648b08d5ea4e2a2618752d10eb35a4184dbbb5ac Mon Sep 17 00:00:00 2001 From: zodern Date: Mon, 28 Feb 2022 14:55:36 -0600 Subject: [PATCH] Remove duplicate check from useNode The import scanner already checks the path before creating the call to module.useNode. --- packages/modules-runtime/server.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/packages/modules-runtime/server.js b/packages/modules-runtime/server.js index 49e22b6a81..af70093a64 100644 --- a/packages/modules-runtime/server.js +++ b/packages/modules-runtime/server.js @@ -51,20 +51,6 @@ Module.prototype.useNode = function () { throw new Error('npmRequire must be defined to use useNode'); } - var parts = this.id.split("/"); - var start = 0; - if (parts[start] === "") ++start; - if (parts[start] === "node_modules" && - parts[start + 1] === "meteor") { - start += 2; - } - - if (parts.indexOf("node_modules", start) < 0) { - // Don't try to use Node for modules that aren't in node_modules - // directories. - throw new Error('useNode can not be used to import modules outside of node_modules'); - } - // See tools/static-assets/server/npm-require.js for the implementation // of npmRequire. Note that this strategy fails when importing ESM // modules (typically, a .js file in a package with "type": "module" in