Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api-extractor] dts can not rollup when mainEntryPointFilePath in node_modules folder #5066

Open
Timeless0911 opened this issue Jan 7, 2025 · 0 comments

Comments

@Timeless0911
Copy link

Summary

When using dtsRollup feature, I found that it is unable to bundle types from mainEntryPointFilePath in node_modules folder.

Repro steps

https://github.com/Timeless0911/api-extractor-issue-node-modules-entry

Run pnpm gen-types to repro this issue.

Expected result:

If I configure mainEntryPointFilePath to "<projectFolder>/dist/index.d.ts",, the dts bundle in untrimmedFilePath is:

// dist-types/index.d.ts
export declare const num1 = 1;

export declare const num2 = 2;

export declare const num3 = 3;

export declare const numSum: number;

export declare const str1 = "str1";

export declare const str2 = "str2";

export declare const str3 = "str3";

export declare const strSum: string;

export { }

Actual result:

In repro demo, I copy the dist folder generated by tsc to node_modules/.temp

When mainEntryPointFilePath set to "mainEntryPointFilePath": "<projectFolder>/node_modules/.temp/index.d.ts",, the dts bundle in untrimmedFilePath is:

// dist-types/index.d.ts

export * from "./sum";
export * from "./utils/numbers";
export * from "./utils/strings";

export { }

Details

I want to use the dtsRollup feature to bundle the dts files emitted by tsc, so I need to put them in a temporary folder of node_modules to avoid publishing them to npm.

I do not want to put them directly in temp folder in projectFolder since most build tools like swc and webpack all generate temp files in node_modules folder.

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/api-extractor version? 7.48.1
Operating system? Mac
API Extractor scenario? rollups (.d.ts)
Would you consider contributing a PR? No
TypeScript compiler version? 5.7.2
Node.js version (node -v)? 22.10.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs triage
Development

No branches or pull requests

1 participant