From fcfe2c191d1abf5b8d97bdbe0571dc2202bb0ba7 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 29 Nov 2019 11:46:59 +0100 Subject: [PATCH] feat: Expose parent env require on `require.fromParentEnvironment` --- lib/webmake.tpl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/webmake.tpl b/lib/webmake.tpl index 03e816e..1e2f90b 100644 --- a/lib/webmake.tpl +++ b/lib/webmake.tpl @@ -103,9 +103,11 @@ return resolve(scope, tree, path, fullPath, state, id); }; getRequire = function (scope, tree, id) { - return function (path) { + var localRequire = function (path) { return wmRequire(scope, [].concat(tree), path, id); }; + if (envRequire) localRequire.fromParentEnvironment = envRequire; + return localRequire }; return getRequire(modules, [], ''); -}) \ No newline at end of file +})