Replies: 1 comment
|
Short answer: your diagnosis matches the source exactly, master still has this shape, and What I confirmed against master (0.1.6-alpha.1):
and line 82 Is master still affected? The shape is unchanged (globs, entry, clean:false all identical), but I scanned What to do: Your suggestions 1 (plan-only orphan check at the start of scripts/build.ts with an actionable message) and 3 (document clean as recovery) both look sensible to me; suggestion 2 needs a change in tsdown's workspace enumeration, which the current 0.22.2 doesn't offer. Not verified: I didn't run a full build on master myself, and your 393-build/218-artifact numbers are your environment's. If it happens again, the first MISSING_EXPORT line plus the swept directory list would confirm which dir got bundled. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
After a refactor that deletes or moves packages, any working copy that has been built before accumulates manifest-less directories containing only ignored build output (
lib/,node_modules/,*.tsbuildinfo).git clean -fddoes not remove them (they are gitignored), and the tsdown workspace glob (packages/*/*,vendor/*,apps/cli) still matches them. The stalelibtrees then get bundled, and the build fails with confusingMISSING_EXPORTerrors that reference paths from before the refactor.Environment
cd5ef814(merge of 历史记录加载不出来的bug,可以这么改 #3248, dsh-0.1.2-alpha.1)git reset --hard+git clean -fd+pnpm install+pnpm run buildon every updateWhat happened in the wild
After updating to
cd5ef814, the build failed withBuild failed with 7 errorsrepeated across ~134 tsdown projects (a 300 MB log), all pointing at exports that no longer exist:Note
../../api/remotes/src/index.ts: the package had already moved topackages/api/remotes. The path comes from stale build output of a deleted package (packages/host/apiproxy), not from anything in the current tree.Root cause
packages/host/apiproxy,packages/client/runtime,packages/examples/*).git reset --hardremoves their tracked files, but the gitignoredlib/andnode_modules/survivegit clean -fd, leaving manifest-less directories.package.json. For a directory without its owntsdown.config.ts, config loading walks up to the root config, whose host-face entry islib/types/{index,invariant,startup}.js.lib/types/*.jsresolves as the entry and rolldown bundles it; its imports reference symbols the refactor removed →MISSING_EXPORT. The misleading relative path is resolved from the stale artifact's own location.Minimal reproduction (30 seconds, on a built tree)
scripts/clean.tsalready handles exactly this case (manifest-less directories whose content is only known residue are removed; unknown content aborts the clean), andpnpm run cleanunblocked us — a fullpnpm install && pnpm run buildafterwards succeeds (393 tsdown builds, 218 client artifacts recorded). But nothing runs or even points to the clean script when the build fails, so the failure looks like a broken tree at the new commit.Suggestions
scripts/clean.ts(plan-only) at the start ofscripts/build.tsand fail with an actionable message, e.g. "stale manifest-less package directories found — runpnpm run clean".package.jsonduring workspace enumeration.pnpm run cleanas the recovery step after refactors that delete or move packages.All reactions