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

Tracking issue: Make Cucumber libraries ESM only #2232

Open
davidjgoss opened this issue Feb 9, 2025 · 0 comments
Open

Tracking issue: Make Cucumber libraries ESM only #2232

davidjgoss opened this issue Feb 9, 2025 · 0 comments
Assignees

Comments

@davidjgoss
Copy link
Contributor

davidjgoss commented Feb 9, 2025

Context

Cucumber, as a set of JavaScript libraries, is in a bit of a messy state when it comes to CommonJS vs ESM:

  • Some libraries remain CommonJS, meaning they are increasingly limited in what dependencies they can adopt/upgrade
  • Some libraries have a dual module format, which still suffers from the above issue but adds complexity
  • Some libraries are ESM only already (just react-components to my knowledge, which is fine because it only targets browser bundlers)

Switching all libraries to ESM only would simplify things and remove constraints on using ESM-only dependencies. This has not been a realistic prospect because userland code will be require()ing our libraries, which doesn't work.

New developments

However, Node.js now supports require(esm) (as long as the target module has no top-level awaits). This has been backported to 20.x without a flag.

This means that for Node.js 20.x and above, making our libraries ESM only should not cause any issues.

Proposal

When we drop Node.js 18.x support, change the libraries to be ESM-only. This will need a test in each repo to prove it works, and catch regressions if e.g. a transitive dependency were to introduce a top-level await.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant