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
- Create a project with
"type": "module" in package.json
- Install
@microsoft/api-extractor@7.57.0
- Import from
@microsoft/api-extractor in an ESM context (e.g. via vite-plugin-dts)
- 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
Summary
@microsoft/api-extractor@7.57.0ships ESM entry points (lib-esm/) with extensionless imports, which breaks Node.js ESM module resolution.The package's
exportsfield correctly points tolib-esm/index.js:But
lib-esm/index.jscontains extensionless imports like:Node.js ESM requires explicit
.jsextensions, so this fails with:This is a regression from v7.56.3 where this worked correctly.
Repro steps
"type": "module"inpackage.json@microsoft/api-extractor@7.57.0@microsoft/api-extractorin an ESM context (e.g. viavite-plugin-dts)Expected result: Module resolves successfully.
Actual result:
Workaround: Pin
@microsoft/api-extractorto7.56.3.Standard questions
@microsoft/api-extractorversion?vite-plugin-dtsnode -v)?Generated with Claude Code