Skip to content

Commit 46cfca4

Browse files
committed
fix: ensure parse default out dir from scaffold
1 parent 8c30eb2 commit 46cfca4

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ export interface PluginOptions {
362362
*
363363
* Can be an array to output to multiple directories.
364364
*
365-
* Defaults to 'build.outDir' of the Vite config, or `outDir` of tsconfig.json if using Rollup.
365+
* The default is to use the out directory provided by the scaffold.
366366
*/
367367
outDir?: string | string[],
368368

README.zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ export interface PluginOptions {
379379
*
380380
* 可以指定一个数组来输出到多个目录中
381381
*
382-
* 默认为 Vite 配置的 'build.outDir',使用 Rollup 时为 tsconfig.json 的 `outDir`
382+
* 默认使用脚手架提供的输出目录
383383
*/
384384
outDir?: string | string[],
385385

packages/unplugin-dts/src/core/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ export interface CreateRuntimeOptions {
3232
/**
3333
* Specify root directory.
3434
*
35-
* Defaults to the 'root' of the Vite config, or `process.cwd()` if using Rollup.
35+
* The default is to use the root provided by the scaffold; if none is provided, it defaults to `process.cwd()`.
3636
*/
3737
root: string,
3838
/**
3939
* Output directory for declaration files.
4040
*
4141
* Can be an array to output to multiple directories.
4242
*
43-
* Defaults to 'build.outDir' of the Vite config, or `outDir` of tsconfig.json if using Rollup.
43+
* The default is to use the out directory provided by the scaffold.
4444
*/
4545
outDirs?: string | string[],
4646
/**

packages/unplugin-dts/src/plugin.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ export const pluginFactory: UnpluginFactory<PluginOptions | undefined> = /* #__P
120120
indexName = `${(fileName || 'index')}.d.ts`
121121
}
122122

123+
if (!options.outDirs && compiler.options.output.path) {
124+
outDirs = [ensureAbsolute(compiler.options.output.path, root)]
125+
}
126+
123127
handleDebug('parse webpack(rspack) config')
124128
}
125129

0 commit comments

Comments
 (0)