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] Inconsistent rollups behaviour between moduleResolution #5106

Open
Lukinoh opened this issue Feb 12, 2025 · 0 comments
Open

Comments

@Lukinoh
Copy link

Lukinoh commented Feb 12, 2025

Summary

In my project, I have libraries that generate types using vite-plugin-dts which uses underneath api-extractor.
When I migrated the tsconfig.json from moduleResolution: node to moduleResolution: bundler I realised that the output .d.ts was not identical.

Repro steps

The following repository is configured to use the api-extractor on the same code, but with 3 different moduleResolution: node, node16 and bundler.`

  • git clone [email protected]:Lukinoh/repro-api-extractor-bug (Stackblitz)
  • cd repro-api-extractor-bug
  • npm install
  • npm run build
  • Look at the dist folders, it contains for each moduleResolution:
    • The result of the tsc build
    • The extracted .d.ts
    • The diagnostics

The extracted .d.ts of node16 and bundler are different from node.
I would have expected to have the content.

Expected result:

declare class ClassExample {
    field1: number;
    field2: string;
}

export declare const functions: ClassExample[];

export { }

Actual result:

import { ClassExample } from './hop/f1.ts';

export declare const functions: ClassExample[];

export { }

Standard questions

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

Question Answer
@microsoft/api-extractor version? 7.49.2
Operating system? Linux (WSL2)
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.14.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