Reproduction link or steps
- Assume there're project A, B and C; B and C imports declarations from A, and C will bundle A.
- With the config like this
export default defineConfig([
{ entry: 'src/from/a' },
{ entry: 'src/from/b' },
{ entry: 'src/from/c', deps: { onlyAllowBundle: false } },
])
- Build it in watch mode
- Edit project A, adding new exports or changing impl.
What is expected?
When adding new exports (changing dts), B and C should rebuild.
When changing impl (modifying function impl), C should rebuild.
What is actually happening?
Only A get rebuild, while B and C don't.
Any additional comments?
Using multiple calls to build in API mode does achieve part of the goal. In that case, editing A would causing B and C rebuilding as if A is missing (dist of A is cleaned). At least tsdown in this case knows that B and C depends on A.
https://github.com/neko-para/maa-support-extension/blob/276debb176cfeb06a729ed5b7c052d236ca02862/scripts/utils.mjs
/**
*
* @param {string[]} folders
*/
export async function watchChain(folders) {
while (folders.length > 0) {
const folder = folders.shift()
console.log('watch', folder)
const { promise, resolve } = Promise.withResolvers()
build({
config: path.resolve(import.meta.dirname, '..', folder, 'tsdown.config.mts'),
watch: true,
onSuccess: resolve
})
await promise
}
}
Reproduction link or steps
What is expected?
When adding new exports (changing dts), B and C should rebuild.
When changing impl (modifying function impl), C should rebuild.
What is actually happening?
Only A get rebuild, while B and C don't.
Any additional comments?
Using multiple calls to
buildin API mode does achieve part of the goal. In that case, editing A would causing B and C rebuilding as if A is missing (dist of A is cleaned). At least tsdown in this case knows that B and C depends on A.https://github.com/neko-para/maa-support-extension/blob/276debb176cfeb06a729ed5b7c052d236ca02862/scripts/utils.mjs