@@ -26,6 +26,7 @@ import {
26
26
queryPublicPath ,
27
27
removeDirIfEmpty ,
28
28
resolve ,
29
+ resolveConfigDir ,
29
30
runParallel ,
30
31
setModuleResolution ,
31
32
toCapitalCase ,
@@ -286,7 +287,14 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
286
287
if ( ! outDirs ) {
287
288
outDirs = options . outDir
288
289
? ensureArray ( options . outDir ) . map ( d => ensureAbsolute ( d , root ) )
289
- : [ ensureAbsolute ( content ?. raw . compilerOptions ?. outDir || 'dist' , root ) ]
290
+ : [
291
+ ensureAbsolute (
292
+ content ?. raw . compilerOptions ?. outDir
293
+ ? resolveConfigDir ( content . raw . compilerOptions . outDir , root )
294
+ : 'dist' ,
295
+ root
296
+ )
297
+ ]
290
298
}
291
299
292
300
const {
@@ -299,7 +307,13 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
299
307
300
308
if ( pathsToAliases && baseUrl && paths ) {
301
309
aliases . push (
302
- ...parseTsAliases ( ensureAbsolute ( baseUrl , configPath ? dirname ( configPath ) : root ) , paths )
310
+ ...parseTsAliases (
311
+ ensureAbsolute (
312
+ resolveConfigDir ( baseUrl , root ) ,
313
+ configPath ? dirname ( configPath ) : root
314
+ ) ,
315
+ paths
316
+ )
303
317
)
304
318
}
305
319
@@ -309,11 +323,15 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
309
323
defaultGlob : string | string [ ]
310
324
) => {
311
325
if ( rootGlobs ?. length ) {
312
- return ensureArray ( rootGlobs ) . map ( glob => normalizeGlob ( ensureAbsolute ( glob , root ) ) )
326
+ return ensureArray ( rootGlobs ) . map ( glob =>
327
+ normalizeGlob ( ensureAbsolute ( resolveConfigDir ( glob , root ) , root ) )
328
+ )
313
329
}
314
330
315
331
return ensureArray ( tsGlobs ?. length ? tsGlobs : defaultGlob ) . map ( glob =>
316
- normalizeGlob ( ensureAbsolute ( glob , configPath ? dirname ( configPath ) : root ) )
332
+ normalizeGlob (
333
+ ensureAbsolute ( resolveConfigDir ( glob , root ) , configPath ? dirname ( configPath ) : root )
334
+ )
317
335
)
318
336
}
319
337
@@ -356,7 +374,7 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
356
374
}
357
375
358
376
publicRoot = compilerOptions . rootDir
359
- ? ensureAbsolute ( compilerOptions . rootDir , root )
377
+ ? ensureAbsolute ( resolveConfigDir ( compilerOptions . rootDir , root ) , root )
360
378
: compilerOptions . composite && compilerOptions . configFilePath
361
379
? dirname ( compilerOptions . configFilePath as string )
362
380
: queryPublicPath (
0 commit comments