Skip to content

[api-extractor] v7.57.0 lib-esm has extensionless imports, breaking Node.js ESM resolution #5644

@silverwind

Description

@silverwind

Summary

@microsoft/api-extractor@7.57.0 ships ESM entry points (lib-esm/) with extensionless imports, which breaks Node.js ESM module resolution.

The package's exports field correctly points to lib-esm/index.js:

".": {
  "import": "./lib-esm/index.js",
  "require": "./lib-commonjs/index.js"
}

But lib-esm/index.js contains extensionless imports like:

export { ConsoleMessageId } from './api/ConsoleMessageId';

Node.js ESM requires explicit .js extensions, so this fails with:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module
'.../node_modules/@microsoft/api-extractor/lib-esm/api/ConsoleMessageId'
imported from .../node_modules/@microsoft/api-extractor/lib-esm/index.js

This is a regression from v7.56.3 where this worked correctly.

Repro steps

  1. Create a project with "type": "module" in package.json
  2. Install @microsoft/api-extractor@7.57.0
  3. Import from @microsoft/api-extractor in an ESM context (e.g. via vite-plugin-dts)
  4. Run with Node.js v22+

Expected result: Module resolves successfully.

Actual result:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module
'/path/node_modules/@microsoft/api-extractor/lib-esm/api/ConsoleMessageId'

Workaround: Pin @microsoft/api-extractor to 7.56.3.

Standard questions

Question Answer
@microsoft/api-extractor version? 7.57.0
Operating system? macOS
API Extractor scenario? Used as dependency via vite-plugin-dts
Would you consider contributing a PR? No
TypeScript compiler version? 5.9.3
Node.js version (node -v)? v24.13.1

Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions