rushstack
rushstack copied to clipboard
[api-extractor]: TS paths aliases force bundling cross package definitions when rolluping dts
Summary
We wanna leverage stripping @internal APIs from rolluped dts definition by leveraging publicTrimmedFilePath config. Unfortunately things doesn't work as one would expect.
Actual
When TS Paths aliases are used, cross package type declarations are always inlined(bundled), although there is no bundledPackages being applied.
Expected No matter if yarn workspaces/lerna/symlink resolution or TS path aliases is applied within monorepo to resolve absolute package paths, api-extractor should not inline(bundle) cross package type definitions.
Repro steps
Steps:
- run
yarn build - check output:
check packages/one/dist/public.d.ts:

- ✅
internalOnehas been stripped as expected (inside package API) - 🐛
Attributesre-export hasn't been stripped (3rd party/node_modules package) - This should have been removed ! - https://github.com/microsoft/rushstack/issues/3444
check packages/two/dist/public.d.ts:

- ✅
internalOnehas been stripped as expected (re-export from a different within repo package API) - 🐛 inlined
BaseballandHellofrom@org/twopackage (re-export from a different within repo package ) - should have been only re-export ofBaseball!
Details
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question | Answer |
|---|---|
@microsoft/api-extractor version? |
7.24.2 |
| Operating system? | Linux/Mac |
| API Extractor scenario? | rollups (.d.ts) |
| Would you consider contributing a PR? | Maybe |
| TypeScript compiler version? | 4.6.4 |
Node.js version (node -v)? |
14.8.1 |