Recent node.js versions can understand conditional exports and subpath exports in package.json. And there are many packages using it even though it is commonjs-only. To use those exports in commonjs, moduleResolution need to be at least node16.
Recently I encountered this error when building using zshy with @opentelemetry/semantic-conventions/incubating.
There are types at '.../node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.
... } from '@opentelemetry/semantic-conventions/incubating';
So... could this kind of option be added?
{
"zshy": {
+ "cjs": "node16" // can be one of `true`, `false` and `"node16"`
}