Conditional exports to simplify ECMAScript import #1589
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request
Problem
We are currently using a subpath for ECMAScript imports.
Node.js has added support for conditional imports which allows using same path for CommonJs and ECMAScript imports:
but the combination of ECMAScript without a warning and the conditional export support are only available from Node.js v12.20.0.
Node.js v12 is still LTS until 2022-04-30:
Related: #1284
Solution
Add conditional exports to
package.json
for unqualified import. Still support the old subpath import. Update required Node.js version to v12.20.0.v12.20.0 was released 2020-11-24, so by the time Commander v9 is released it will have been available for over a year.
Or we could just wait until after Node 12 is EOL before adopting conditional exports in Commander v10?!
ChangeLog