Skip to content

register/esm load result mismatch #696

Description

@jacogr

Really happy to see the register/esm appearing. This is brilliant.

I'm using the latest Node LTS 18 and the currently-released 1.6.2.

Using this combo, I receive the following error when passing --loader @swc-node/register/esm on a project -

TypeError [ERR_INVALID_RETURN_PROPERTY_VALUE]: Expected a url string to be returned for the "url" from the "@swc-node/register/esm 'resolve'" function but got instance of String.
         at new NodeError (node:internal/errors:399:5)
         at ESMLoader.resolve (node:internal/modules/esm/loader:882:15)
         at async ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:7)
         at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:79:21) {
       code: 'ERR_INVALID_RETURN_PROPERTY_VALUE'

Based on the (current) Node loader documentation the return should be something like url: new URL(url).href (using the as-is code)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions