-
-
Notifications
You must be signed in to change notification settings - Fork 140
Description
Reproduction link or steps
https://stackblitz.com/edit/github-ggwk8zxw?file=tsdown.config.ts
Run pnpm build.
What is expected?
With copy.from: [], copy: [], or a function that returns an empty array, I'd expect the No files matched for copying warning not to show.
What is actually happening?
A No files matched for copying warning is logged, which subsequently fails on CI.
Any additional comments?
While it doesn't make sense to configure an literal empty array as in the example, if a copy function conditionally returns an empty array, I'd expect the warning not to be logged in that case.
Basically, I want to conditionally copy files if they are present, otherwise don't copy any files. My use case is in a monorepo with a top-level tsdown config shared by many packages which may or may not contain assets I want to copy. Statically declaring the copy config for each package ahead of time would work, but is quite tedious, so I'd prefer to glob for them ahead of time, and if any are found, tell tsdown to copy them to dist.