-
Notifications
You must be signed in to change notification settings - Fork 670
Closed
Description
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"inpackage.json - Install
@microsoft/api-extractor@7.57.0 - Import from
@microsoft/api-extractorin an ESM context (e.g. viavite-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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Closed