Skip to content

Commit

Permalink
feat: rebuild when tsup.confg.* file changes in watch mode
Browse files Browse the repository at this point in the history
  • Loading branch information
lvqq committed Nov 21, 2022
1 parent a2803dd commit 46294ba
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
) {
watcher.close();
await build(_options)
return;
}
if (file === 'package.json' && !buildDependencies.has(file)) {
const currentHash = await getAllDepsHash(process.cwd())
shouldSkipChange = currentHash === depsHash
Expand Down

0 comments on commit 46294ba

Please sign in to comment.