Skip to content

Allow vm.Module creators to customize import.meta in the created module #18570

@TimothyGu

Description

@TimothyGu

In #17560, we added the ability for users to created their own ECMAScript Modules with the vm.Module class (more information can be found in the documentation). However, as of right now the import.meta exposed in vm.Modules is always an empty object:

> module = new vm.Module('import.meta')
Module {
  status: 'uninstantiated',
  linkingStatus: 'unlinked',
  url: 'vm:module(0)',
  context: undefined }
> (node:22093) ExperimentalWarning: vm.Module is an experimental feature. This feature could change at any time
> await module.link(() => {})
undefined
> module.instantiate()
undefined
> var { result } = await module.evaluate()
undefined
> result
{}

Ideally, we would like the callers of vm.Module to be able to customize what import.meta contains in the created module.

Metadata

Metadata

Assignees

Labels

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