[api-extractor] Allow configuration of external packages
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- tooling
Research direction
Start with the external-module detection logic in apps/api-extractor/src/analyzer/ExportAnalyzer.ts, especially the linked lines, and trace how the existing option for additionally included packages is configured. Review the API Extractor configuration path before deciding how string or regex matching should be represented. Done means imports matching the configured external packages remain external instead of being crawled and bundled.
Written by the indexing model from the issue text.
Description
Summary
I am having a monorepo setup where some files are included via code sharing (using typescript path mappings).
In such a setup API extractor detects the imported files from the other projects as internal and tries to crawl and bundle them into the final types and API.
But according to my build setup the imported files will be external references in the final output.
To mitigate this problem I want to tell API extractor somehow that these imports are external modules.
Details
- API extractor detects the external modules here: https://github.com/microsoft/rushstack/blob/f1bdeddfc0abcc987fdfe0b4d1e82f1ea2b4f65f/apps/api-extractor/src/analyzer/ExportAnalyzer.ts#L264-L313
- There is already an option to additionally include packages
- There is no option to force an import to be an external module.
Bundlers like Rollup/Rolldown have dedicated options like: https://rollupjs.org/configuration-options/#external to control the externals. I think a similar string+regex option could solve this.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question | Answer |
|---|---|
@microsoft/api-extractor version? |
7.53.1 |
| Operating system? | Wom |
| API Extractor scenario? | rollups (.d.ts) --> |
| Would you consider contributing a PR? | Yes |
| TypeScript compiler version? | 5.9.3 |
Node.js version (node -v)? |
v24.11.0 |
- Dominant language
- TypeScript
- Stars
- 6.5k
- Forks
- 708
- Avg merge
- 4d 13h
- Merged PRs (30d)
- 62
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/rushstack
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
All issues in microsoft/rushstack
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
bcgov/bc-wallet-mobile#4761 · 1 comment ·
-
external-issue to-triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
area-deployment area-integrations triage:bot-seen
Difficulty 2/5 Half a day Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
refactor
Difficulty 2/5 1-3 hours Newbie friendliness 84/100