Skip to content

Link modules with paths in module.link(linker) #35848

Description

@lacmuch

https://nodejs.org/api/vm.html#vm_module_link_linker

Now we can only link "standard" modules with functions combined with SyntheticModules, like this:

await module.link( function( spec ) {
	
    return new Promise( async function( resolve, reject ) {
	
	const mod = await import( spec );
        resolve( new vm.SyntheticModule( [ 'default' ], function() {

            this.setExport( 'default', mod.default );
        }, { context } ) );
    } )
} );

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

    esmIssues and PRs related to the ECMAScript Modules implementation.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.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