Skip to content

Provide some option to set moduleResolution to node16 with CJS build #62

@rlj1202

Description

@rlj1202

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"`
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions