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

fix: include .d.ts extension in multiple outputs #161

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/plugin.ts
Expand Up @@ -438,7 +438,7 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
const typesPath = types ? resolve(root, types) : resolve(outputDir, indexName)

for (const name of entryNames) {
let filePath = multiple ? resolve(outputDir, name.replace(tsRE, '.d.ts')) : typesPath
let filePath = multiple ? resolve(outputDir, `${name}.d.ts`) : typesPath
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should judge whether the extension is included here, because it will fail when extension exists (xxx.ts -> xxx.ts.d.ts).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we should apply the same change to line 491.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense 👍

Also, I'm no longer using your library and don't have time to contribute anymore. Feel free to pick up this PR where I left off.

Copy link
Owner

@qmhc qmhc Jan 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right, thanks for your contributions, I will fix it directly.


if (fs.existsSync(filePath)) continue

Expand Down