From 6e33c8966b3f141dd4f4e38cd08224651c1d1554 Mon Sep 17 00:00:00 2001 From: Alan Plum Date: Mon, 2 Jun 2014 15:01:37 +0200 Subject: [PATCH] Fallback for sub-module requires. Fixes #789. --- js/common/bootstrap/modules.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/js/common/bootstrap/modules.js b/js/common/bootstrap/modules.js index a17dcaf30a..465306cbbb 100644 --- a/js/common/bootstrap/modules.js +++ b/js/common/bootstrap/modules.js @@ -834,6 +834,17 @@ function require (path) { } } + // check if there is a package containing this module + path = path.substr(1); + if (path.indexOf('/') !== -1) { + var p = path.split('/'); + localModule = requirePackage(currentModule, '/' + p.shift()); + if (localModule !== null) { + localModule = requirePackage(localModule, '/' + p.join('/')); + return localModule; + } + } + // nothing found return null; }