Skip to content

Cannot return value from a SourceTextModule to the caller #37453

Closed
@clecap

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.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