Commit 346e882
committed
[api-extractor] Surface bundledPackages no-op when packageId is missing (#5730)
When `bundledPackages` is configured but TypeScript could not assign a
`packageId` to a resolved module, the lookup in `_isExternalModulePath`
silently failed via optional chaining and the module was bundled as
external. The most common cause is a local workspace package whose
`package.json` lacks a `"version"` field — TypeScript does not assign
a `packageId` without one (microsoft/TypeScript#63307).
Throw an `InternalError` with a remediation message in that exact
combination (`packageId` undefined AND `_bundledPackageNames.size > 0`)
so users see the cause instead of staring at an unexpectedly-not-bundled
`from "foo"` in their `.d.ts` rollup.
The non-bundled case (`_bundledPackageNames.size === 0`) is unchanged
— the missing `packageId` flows through to the existing
`isExternalLibraryImport` check that already handles ambiguous modules.
Matches the fix suggested by the issue reporter in #5730.1 parent e625a0f commit 346e882
2 files changed
Lines changed: 32 additions & 0 deletions
File tree
- apps/api-extractor/src/analyzer
- common/changes/@microsoft/api-extractor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
303 | 325 | | |
304 | 326 | | |
305 | 327 | | |
| |||
common/changes/@microsoft/api-extractor/fix-bundled-packages-missing-version_2026-05-27-19-00.json
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments