diff --git a/doc/api/vm.md b/doc/api/vm.md index b8c112cf51a954..92892f49cd9693 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -485,8 +485,8 @@ function resolveAndLinkDependencies(module) { // The "secret" variable refers to the global variable we added to // "contextifiedObject" when creating the context. export default secret; - `, { context: referencingModule.context }); - moduleMap.set(specifier, linkedModule); + `, { context: module.context }); + moduleMap.set(specifier, requestedModule); // Resolve the dependencies of the new module as well. resolveAndLinkDependencies(requestedModule); } @@ -566,8 +566,8 @@ const contextifiedObject = vm.createContext({ // The "secret" variable refers to the global variable we added to // "contextifiedObject" when creating the context. export default secret; - `, { context: referencingModule.context }); - moduleMap.set(specifier, linkedModule); + `, { context: module.context }); + moduleMap.set(specifier, requestedModule); // Resolve the dependencies of the new module as well. resolveAndLinkDependencies(requestedModule); }