-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: ESM! #127
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really great work, thanks a lot 🙇 The remaining problem seems to be that ESM does not support "folder imports" (if I'm not mistaken, all four errors are basically the same).
So while this works:
// index.js
let { foo } = require("./example");
console.log(foo);
// example/index.js
exports.foo = 2;
This does not work:
import { foo } from "./example";
console.log(foo);
// example/index.js
export const foo = 2;
Error Message:
Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/tmp/foo/example' is not supported resolving ES modules imported from /tmp/foo/index.js
Did you mean to import ../example/index.js?
So we probably need to attach an /index.js
to those cases 🤔
faucet relying on Node's module-resolution algorithm internally makes this change somewhat tricky now. Because this warrants separate investigation, I've extracted #137 so this PR can exclusively focus on ESM.
|
cf. #80