From e29fdaa421cc5f4f7eda134aa7cfa16a0478c6fa Mon Sep 17 00:00:00 2001 From: Phillip Kovalev Date: Sat, 20 Feb 2016 11:30:43 +0300 Subject: [PATCH] module: return correct exports from linked binding Method `LinkedBinding` must return the same "exports" property of the module as cached, because property can be overridden by an initialization function. --- src/node.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/node.cc b/src/node.cc index 05984745de080f..e11562af1acb96 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2450,9 +2450,10 @@ static void LinkedBinding(const FunctionCallbackInfo& args) { return env->ThrowError("Linked module has no declared entry point."); } - cache->Set(module_name, module->Get(exports_prop)); + auto effective_exports = module->Get(exports_prop); + cache->Set(module_name, effective_exports); - args.GetReturnValue().Set(exports); + args.GetReturnValue().Set(effective_exports); } static void ProcessTitleGetter(Local property,