You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Context
Cucumber, as a set of JavaScript libraries, is in a bit of a messy state when it comes to CommonJS vs ESM:
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.
The text was updated successfully, but these errors were encountered: