Skip to content

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

@lacmuch

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 } ) );
    } )
} );

Metadata

Metadata

Assignees

No one assigned

    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