-
Notifications
You must be signed in to change notification settings - Fork 772
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
ESM support #974
ESM support #974
Conversation
ccf9026
to
d0328e9
Compare
"exports": { | ||
".": "./lib/index.js", | ||
"./esm": "./lib/esm.mjs" | ||
}, |
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.
Have you considered using export conditions so it automatically exports the ESM version when import
is used instead of require
?
"exports": {
".": {
"require": "./lib/index.js",
"import": "./lib/esm.mjs"
},
"./esm": "./lib/esm.mjs"
}
I added the ./esm
in case, but this way, you may not even need the ./esm
endpoint:
"exports": {
"require": "./lib/index.js",
"import": "./lib/esm.mjs"
}
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.
I don't want to do that, because the ESM version doesn't export normal fs
methods like the CJS version does. Since it's a different feature set, it's best to be explicit. Otherwise, I'd definitely do this.
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.
Why the regression? Sounds it can be kept with:
export * from 'fs';
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.
See #746 (comment)
Depends on #970
Review commit-by-commit.
Breaking change, as it switches from
main
toexports
inpackage.json
, outlawing all subpath imports except those explicitly specified.Fixes #746