Uh oh!
There was an error while loading. Please reload this page.
fix(build): deterministic flat plugin .d.ts to stop flaky app-shell build (#1760) - #1766
Merged
Conversation
…pecifiers (#1760) vite-plugin-dts was configured with compilerOptions.rootDir at the monorepo root plus @object-ui/* aliases pointing into sibling src. This produced a deeply nested dist layout (dist/packages/<pkg>/src/*.d.ts) and rewrote cross-package type imports to relative paths into sibling src (e.g. ../../types/src). Under a full parallel `turbo run build` this was non-deterministic: app-shell's composite tsc intermittently failed to resolve some plugin's .d.ts (error TS2307: Cannot find module '@object-ui/plugin-*'), flipping the Bundle Analysis / Build CI job red or flaky. Fix, applied consistently across all dts-emitting packages: - compilerOptions.rootDir -> each package's own src, so dts emit is flat (dist/index.d.ts + dist/*.d.ts; no nested packages/<pkg>/src tree). - aliasesExclude: [/^@object-ui\//], so cross-package type imports stay bare (`@object-ui/types`) and resolve to each dependency's own built dist .d.ts instead of being rewritten to relative sibling-src paths (which were broken under the nested layout and dragged raw cross-package src once flattened). JS bundles are byte-identical (rollup already externalizes bare imports; the aliases only fed the bundler/tests, not the published JS). app-shell ReportView: annotate viewerSchema as ReportViewerSchema. This is a real type error that was previously masked because the broken relative-path type resolution degraded ReportViewer's prop type to `any`; it surfaces once the plugin .d.ts resolve correctly. Verified: `turbo run build --filter='./packages/*'` (the Bundle Analysis CI job) is green and deterministic across repeated clean runs; previously the same command intermittently failed app-shell with TS2307. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
Uh oh!
There was an error while loading. Please reload this page.
os-zhuang added a commit
that referenced
this pull request
Jun 15, 2026
Composite-tsc packages (composite: true) write incremental state to <package>/tsconfig.tsbuildinfo at the package root. turbo's `build` task only declared dist/**/.next/**/build/** as outputs, so the incremental build-info was neither hashed nor cached/restored in sync with dist. A turbo cache hit then restored dist but left whatever stale tsbuildinfo happened to be on disk, and a build run with a desynced tsbuildinfo could under-emit (e.g. tsc believing the project is up-to-date), producing a partial dist that turbo would then cache and replay — surfacing as `TS2307: Cannot find module '@object-ui/app-shell'` in consumers. Add **/*.tsbuildinfo to the `build` task outputs so incremental state is cached and restored atomically with dist. CI fresh checkouts were already safe (*.tsbuildinfo is gitignored → always a full emit); this closes the local / warm-cache desync. Follow-up to #1760 / #1766. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Closes#1760. Under a full parallel
turbo run build,@object-ui/app-shell's compositetscintermittently failed witherror TS2307: Cannot find module '@object-ui/plugin-*', flipping the Bundle Analysis / Build job red or flaky. Long-masked by the turbo cache, so any PR touching an app-shell dependency could trip it — eroding CI trust.Root cause
Every dts-emitting package configured
vite-plugin-dtswithcompilerOptions.rootDirat the monorepo root plus@object-ui/*resolve.aliasentries pointing into siblingsrc. Consequences:dist/packages/<pkg>/src/*.d.ts, withdist/index.d.tsre-exporting the deep./packages/<pkg>/src/index.jspath.../../types/src). Under the nested layout these pointed nowhere valid → consumers silently degraded those types toany(masking real type errors); flattened naively they resolve to rawsrc→ consumers re-walk/recompile cross-package source.Generating this nested, cross-
src-walking.d.tsfor ~15 plugins concurrently is unstable, so app-shell's compositetscintermittently couldn't resolve a plugin's.d.ts. Building app-shell in isolation always succeeded — consistent with a concurrency race.Fix
Applied consistently to all dts-emitting packages (
vite.config.ts):compilerOptions.rootDir→ each package's ownsrc⇒ flat emit (dist/index.d.ts+dist/*.d.ts, no nestedpackages/<pkg>/srctree).aliasesExclude: [/^@object-ui\//]⇒ cross-package type imports stay bare (@object-ui/types) and resolve to each dependency's own builtdist/*.d.ts, instead of being rewritten to relative sibling-srcpaths.Plus
packages/app-shell/src/views/ReportView.tsx: annotateviewerSchemaasReportViewerSchema— a real type error that was previously masked because the broken relative-path resolution degradedReportViewer's prop type toany.JS bundles are byte-identical — rollup already externalizes bare imports via
rollupOptions.external; the aliases only fed the bundler/tests, not the published JS.Verification
This is a flaky build-system fix, so it needs repeated proof:
pnpm buildreproducedapp-shellfailing withCannot find module '@object-ui/plugin-report'.pnpm turbo run build --filter='./packages/*'is green across 5 clean runs (turbo cache +*.tsbuildinfo+distcleared each pass):37/37tasks,cannot-find=0,TSerr=0..d.ts: flat layout, zero relative../../*/srcrefs, all cross-package imports bare@object-ui/*. app-shell (a downstream consumer) type-checks against the plugin.d.tsand builds green.🤖 Generated with Claude Code