Skip to content

Commit

Permalink
fix: put copyDtsFiles option in use (#53)
Browse files Browse the repository at this point in the history
fix #52
  • Loading branch information
Ettapp committed Jan 10, 2022
1 parent e9d2f77 commit 261700f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/plugin.ts
Expand Up @@ -73,6 +73,7 @@ export function dtsPlugin(options: PluginOptions = {}): Plugin {
noEmitOnError = false,
skipDiagnostics = true,
logDiagnostics = false,
copyDtsFiles = true,
afterDiagnostic = noop,
beforeWriteFile = noop,
afterBuild = noop
Expand Down Expand Up @@ -238,13 +239,17 @@ export function dtsPlugin(options: PluginOptions = {}): Plugin {
})

files.forEach(file => {
includedFileSet.add(
dtsRE.test(file) ? file : `${tjsRE.test(file) ? file.replace(tjsRE, '') : file}.d.ts`
)

if (dtsRE.test(file)) {
if (!copyDtsFiles) {
return
}

includedFileSet.add(file)
sourceDtsFiles.add(project.addSourceFileAtPath(file))
return
}

includedFileSet.add(`${tjsRE.test(file) ? file.replace(tjsRE, '') : file}.d.ts`)
})

if (hasJsVue) {
Expand Down

0 comments on commit 261700f

Please sign in to comment.