From 32a49c135a670d1e63627f04f3a2eb759a9866d2 Mon Sep 17 00:00:00 2001 From: lvqq Date: Mon, 21 Nov 2022 13:27:53 +0800 Subject: [PATCH] feat: rebuild when tsup.confg.* file changes in watch mode --- src/index.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/index.ts b/src/index.ts index 9552ebbc0..f7c3b8aba 100644 --- a/src/index.ts +++ b/src/index.ts @@ -345,6 +345,20 @@ export async function build(_options: Options) { let shouldSkipChange = false if (options.watch === true) { + // If tsup.config changes, close current watcher and rerun build + if ( + [ + 'tsup.config.ts', + 'tsup.config.js', + 'tsup.config.cjs', + 'tsup.config.mjs', + 'tsup.config.json' + ].includes(file) + ) { + await watcher.close(); + await build(_options) + return; + } if (file === 'package.json' && !buildDependencies.has(file)) { const currentHash = await getAllDepsHash(process.cwd()) shouldSkipChange = currentHash === depsHash