Open
Description
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.