tsdown workspace mode resolves the suite root config as a build target and aborts the run (0.22.2) #6730
Unanswered
Bill-H9986
asked this question in
Q&A
Replies: 1 comment
|
Short answer: everything you cited that lives in this repo checks out, and I could go one better than "unverified" on the tsdown side — this checkout's In-repo facts:
tsdown 0.22.2, verified in the installed dist (
Which workaround fits:
If you're willing to share your repro script or the exact patch shape you ended up with, I'd be happy to sanity-check it against this tree. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
tsdown workspace mode resolves the suite root config as a build target and aborts the whole run
tsdown version: 0.22.2 (rolldown 1.1.1)
Node: v24.19.0 (also reproduced on v24.18.0)
OS: Linux (docker
node:24-bookworm-slim) and Windows 11 — byte-identical failure on bothPackage manager: pnpm 11.7.0
Summary
With a root
tsdown.config.tsthat declaresworkspaceandentry, the workspace run aborts during configresolution — before any package builds — with:
The label is the root package, and the entry is the root config's own
entrytemplate — i.e. the suite rootconfig itself is being resolved as if it were a build target. A repository root is a declaration, not a package with
lib/types/index.js, so this can never succeed.Minimal reproduction
sh reproduce.sh # creates ./tsdown-ws-repro, installs tsdown@0.22.2, runs three variantsThe generated project is the smallest shape that carries the same structure:
Observed
lib/types/index.js✔ Build completefor both packagesapps/weblacks that entry (the real-world case)Error: [@repro/web-frontend] Cannot find entry: ["lib/types/{index,invariant,startup}.js"]workspace: { include: ['packages/*/*'] }(exclude the package that lacks entries)[@repro/root] Cannot find entry[]for the host faceError: undefined No input files, try "tsdown <your-file>" or create src/index.ts{ entry: '' }(theSKIP_WORKSPACE_BUILDshape used bypackages/client/tsdown.client.ts)No input files(the empty entry fails the filter below, so the default branch runs)Root cause pointer
dist/build-*.mjs:Line 98's filter keeps a config when
!config.workspace || config.entry. The suite root config satisfiesconfig.entry(it is the template string), so it passes the filter and is handed toresolveUserConfig, whichresolves
entryagainst the rootcwdand throws atresolveEntry(line 83). Setting the rootentryto anempty string makes
config.entryfalsy, so the filter drops it — and the run then fails one branch later withNo input files, becauseresolveEntryfalls back to<cwd>/src/index.ts, which a suite root does not have.Expected
The suite root config should not be resolved as a build target. Either exclude it explicitly during workspace
expansion, or make the existing "skip this package" convention work for it (client-only packages are skipped today
via a config whose
entryis empty — the docs inpackages/client/tsdown.client.tsdescribe the intent as"Workspace mode replaces an empty config array with the root defaults. A falsey entry instead removes this package
before entry resolution.").
Real-world impact
deepseek-harness(private fork) at tagdsh-v0.1.5-rc.2:pnpm run build:lib:host=tsc -b tsconfig.host.json && tsdown --env.DSH_BUILD_FACE hosttsc -bpasses with 0 errors;tsdown --env.DSH_BUILD_FACE hostfails exactly as above, leaving 81 packages inthe bundle closure without
lib/artifacts, so the downstreampnpm deploycannot materialize the runtime.Workaround in the fork today: none that we could find from the config surface (seven variants tried, A–E above plus
patching the discovery list and moving the config out of the root). A patch to
resolveConfig/line 98 that skips theroot suite config works around it.
All reactions