Skip to content

Support loading of ESM files #13

Open
@novemberborn

Description

@novemberborn

It's unclear to me how we would load compiled ESM files.

Our current approach is to install a hook on require.extensions but this is ignored for ESM files: https://github.com/avajs/babel/blob/c9de6fc63f9bc61abcdfbc99ebf734c1ad5a9210/index.js#L366:L369

Assuming that paths in the Babel output are relative, we could simply import() any given file and assume that everything else will follow. However this means code runs from a different directory leading to subtle failures.

Once we resolve this, we could add a default mjs extension, though this would be a breaking change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions