Skip to content

Conversation

@shadowspawn
Copy link
Collaborator

@shadowspawn shadowspawn commented Aug 25, 2021

Pull Request

Problem

We are currently using a subpath for ECMAScript imports.

import { Command } from 'commander/esm.mjs';

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

  • added: simpler ECMAScript import
  • changed: Commander 9 requires Node.js v14 or higher, or Node.js v12.x from v12.20.0 or higher

@shadowspawn shadowspawn added the semver: major Releasing requires a major version bump, not backwards compatible label Aug 25, 2021
@shadowspawn shadowspawn marked this pull request as ready for review August 25, 2021 08:32
@shadowspawn shadowspawn changed the title Conditional exports to simply ECMAScript import Conditional exports to simplify ECMAScript import Aug 25, 2021
Copy link
Collaborator

@abetomo abetomo left a comment

Choose a reason for hiding this comment

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

👍

@shadowspawn shadowspawn merged commit abec6c5 into tj:release/9.x Aug 26, 2021
@shadowspawn shadowspawn added the pending release Merged into a branch for a future release, but not released yet label Aug 26, 2021
@shadowspawn shadowspawn deleted the feature/modern-exports branch August 27, 2021 23:29
@shadowspawn shadowspawn added this to the Commander v9.0.0 milestone Sep 6, 2021
@shadowspawn shadowspawn removed the pending release Merged into a branch for a future release, but not released yet label Jan 29, 2022
@shadowspawn
Copy link
Collaborator Author

Commander v9 has been released.

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

Labels

semver: major Releasing requires a major version bump, not backwards compatible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants