Skip to content
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

Merged
merged 3 commits into from
Nov 28, 2022
Merged

ESM support #974

merged 3 commits into from
Nov 28, 2022

Conversation

RyanZim
Copy link
Collaborator

@RyanZim RyanZim commented Oct 25, 2022

Depends on #970

Review commit-by-commit.

Breaking change, as it switches from main to exports in package.json, outlawing all subpath imports except those explicitly specified.

Fixes #746

@RyanZim RyanZim added this to the 11.0.0 milestone Oct 25, 2022
This was referenced Oct 25, 2022
Base automatically changed from ryan/fs-readv to master October 31, 2022 18:48
"exports": {
".": "./lib/index.js",
"./esm": "./lib/esm.mjs"
},

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"
}

Copy link
Collaborator Author

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.

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';

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support ESM
2 participants