Skip to content

Node.js based forum software built for the modern web

Fix requiring files outside of node_modules

Timothy Fikeed3bc06dee1b
diff --git a/src/plugins/load.js b/src/plugins/load.js
index 99019e371f..8eac293829 100644
--- a/src/plugins/load.js
+++ b/src/plugins/load.js
@@ -276,7 +276,8 @@ module.exports = function(Plugins) {
* With npm@3, dependencies can become flattened, and appear at the root level.
* This method resolves these differences if it can.
*/
- var atRootLevel = fullPath.match(/node_modules/g).length === 1;
+ var matches = fullPath.match(/node_modules/g);
+ var atRootLevel = !matches || matches.length === 1;
try {
fs.statSync(fullPath);
@@ -329,4 +330,4 @@ module.exports = function(Plugins) {
}
});
};
-};
\ No newline at end of file
+};