doc: fix not working code example in vm docs

PR-URL: https://github.com/nodejs/node/pull/60224
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
This commit is contained in:
Artur Gawlik authored and Antoine du Hamel committed 2025-11-07 18:11:29 +01:00
1 parent 7007f9dd65
commit 8e771632b7
1 file changed
+4 -4
+4 -4
View File
@@ -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);
}