Skip to content

Request a new feature: esModule linker #132

@Gaubee

Description

@Gaubee

Is it possible to implement support for dynamic module resolution?
Reference: nodejs/vm/module.link(linker)

quickJs {
    // ...
    evaluate<String>(
        """
            import * as hello from "hello";
            // Use hello
        """.trimIndent(),
        asModule = true,
        linker = { specifier, referencingModule, extra ->
            val code = fs.open('/path/local/' + specifier).text() // suspend read file func
            val moduleBytecode = compile(
                code = code,
                filename = specifier,
                asModule = true,
            )
            return moduleBytecode
        }
    )
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions