Skip to content

Commit

Permalink
fix: correct .d.ts extension in multiple outputs
Browse files Browse the repository at this point in the history
fix #144
  • Loading branch information
qmhc committed Jan 31, 2023
1 parent dae4ef9 commit 5c9709c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,13 +439,13 @@ 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.replace(tsRE, '')}.d.ts`) : typesPath

if (fs.existsSync(filePath)) continue

const index = resolve(
outputDir,
relative(entryRoot, entries[name].replace(tsRE, '.d.ts'))
relative(entryRoot, `${entries[name].replace(tsRE, '')}.d.ts`)
)

let fromPath = normalizePath(relative(dirname(filePath), index))
Expand Down Expand Up @@ -489,7 +489,7 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {

if (multiple) {
for (const name of entryNames) {
const path = resolve(outputDir, name.replace(tsRE, '.d.ts'))
const path = resolve(outputDir, `${name.replace(tsRE, '')}.d.ts`)

rollupDeclarationFiles({
root,
Expand Down

0 comments on commit 5c9709c

Please sign in to comment.