Skip to content

When there are multiple configurations in defineConfig, using the tsdown --watch mode will cause an infinite loop #408

@Triumph-light

Description

@Triumph-light

Reproduction link or steps

this is my config
`import { defineConfig } from 'tsdown'

export default defineConfig([
{
entry: {
'index.ts': 'src/node/index.ts'
},
outDir: 'dist/node',
},
{
entry: {
'index.ts': 'src/client/index.ts'
},
outDir: 'dist/client',
}
])`

The cause is that when there are multiple configs, two watches are initiated, which monitor all files in the same directory level as tsdown.config.ts. For instance, when dist/client is updated, the second watch is triggered, thus leading to a loop.
tsup doesn't have this issue because it ignores outDir by default.
reproducition:https://github.com/Triumph-light/tsup-tsdown-compare

What is expected?

No Loop

What is actually happening?

Infinite Loop

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions