Skip to content

Cannot return value from a SourceTextModule to the caller #37453

Description

@clecap
  • Version: v15.9.0
  • Platform: macOS Catalina 10.15.6
  • Subsystem: VM

What steps will reproduce the bug?

Make file retu.js.

const vm = require('vm');
const contextifiedSandbox = vm.createContext({ });
(async () => {
  const bar = new vm.SourceTextModule(`19;`, { context: contextifiedSandbox });
  async function linker(specifier, referencingModule) { }
  await bar.link(linker);
  const  result  = await bar.evaluate();
  console.log("Result is: ", result);
})();

Run as node --experimental.vm.modules retu.js

What is the expected behavior?

According to the current state of the documentation I expect an output of Result is: 19

What do you see instead?

Output of: Result is: undefined

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to Node.js documentation.esmIssues and PRs related to the ECMAScript Modules implementation.vmIssues and PRs related to the vm subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions