Skip to content

Commit 085f079

Browse files
committed
feat(dts)!: auto-enable dts when tsconfig declaration is true (#872)
1 parent a104223 commit 085f079

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/config/options.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { blue } from 'ansis'
55
import { createDefu } from 'defu'
66
import isInCi from 'is-in-ci'
77
import { createDebug } from 'obug'
8+
import { parseTsconfig } from 'rolldown-plugin-dts/internal'
89
import { resolveClean } from '../features/clean.ts'
910
import { resolveDepsConfig } from '../features/deps.ts'
1011
import { resolveEntry } from '../features/entry.ts'
@@ -171,9 +172,16 @@ export async function resolveUserConfig(
171172
exe = resolveFeatureOption(exe, {})
172173

173174
if (dts == null) {
174-
dts = exe
175-
? false
176-
: !!(pkg?.types || pkg?.typings || hasExportsTypes(pkg?.exports))
175+
if (exe) {
176+
dts = false
177+
} else if (pkg?.types || pkg?.typings || hasExportsTypes(pkg?.exports)) {
178+
dts = true
179+
} else if (tsconfig) {
180+
const parsed = parseTsconfig(tsconfig)
181+
dts = !!parsed.compilerOptions?.declaration
182+
} else {
183+
dts = false
184+
}
177185
}
178186
dts = resolveFeatureOption(dts, {})
179187

0 commit comments

Comments
 (0)