Skip to content

Commit 1756b03

Browse files
committed
fix: reload config on restart
regression #693
1 parent c45257c commit 1756b03

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

dts.snapshot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"index.d.mts": {
1717
"build": "declare function build(_: InlineConfig): Promise<TsdownBundle[]>",
18-
"buildWithConfigs": "declare function buildWithConfigs(_: ResolvedConfig[], _: string[]): Promise<TsdownBundle[]>",
18+
"buildWithConfigs": "declare function buildWithConfigs(_: ResolvedConfig[], _: string[], _: () => void): Promise<TsdownBundle[]>",
1919
"enableDebug": "declare function enableDebug(_: boolean | Arrayable<string>): void",
2020
"#exports": [
2121
"AttwOptions",

src/build.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ const asyncDispose: typeof Symbol.asyncDispose =
3939
* Build with tsdown.
4040
*/
4141
export async function build(
42-
userOptions: InlineConfig = {},
42+
inlineConfig: InlineConfig = {},
4343
): Promise<TsdownBundle[]> {
44-
globalLogger.level = userOptions.logLevel || 'info'
45-
const { configs, files: configFiles } = await resolveConfig(userOptions)
44+
globalLogger.level = inlineConfig.logLevel || 'info'
45+
const { configs, files: configFiles } = await resolveConfig(inlineConfig)
4646

47-
return buildWithConfigs(configs, configFiles)
47+
return buildWithConfigs(configs, configFiles, () => build(inlineConfig))
4848
}
4949

5050
/**
@@ -56,6 +56,7 @@ export async function build(
5656
export async function buildWithConfigs(
5757
configs: ResolvedConfig[],
5858
configFiles: string[],
59+
_restart: () => void,
5960
): Promise<TsdownBundle[]> {
6061
let cleanPromise: Promise<void> | undefined
6162
const clean = () => {
@@ -71,7 +72,7 @@ export async function buildWithConfigs(
7172

7273
await Promise.all(disposeCbs.map((cb) => cb()))
7374
clearRequireCache()
74-
buildWithConfigs(configs, configFiles)
75+
_restart()
7576
}
7677

7778
const configChunksByPkg = initBundleByPkg(configs)

0 commit comments

Comments
 (0)