Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

app-shell tsc build fails under full turbo build (missing plugin-* .d.ts), masked by turbo cache #1760

Closed

Description

@os-zhuang

Problem

@object-ui/app-shell builds with tsc (composite). Under a full turbo build (pnpm turbo run build --filter='./packages/*', as the performance-budget.yml "Bundle Analysis" job runs), app-shell's tsc fails with ~25 error TS2307: Cannot find module '@object-ui/plugin-*' across many files (DashboardView, ReportView, RecordDetailView, ObjectView, previews, …) plus cascading IntrinsicAttributes / implicit-any errors that are all downstream of the unresolved plugin modules.

This is long-masked by turbo cache: any PR that does not change an app-shell dependency gets a cache hit for app-shell#build and the job is green (e.g. #1743). The first PR that touches an app-shell dependency (e.g. #1757 changed @object-ui/types + plugin-charts/list/view) invalidates the cache, app-shell actually re-builds, and the latent failure surfaces.

Evidence

  • pnpm --filter @object-ui/app-shell build in isolation (deps' dist already present) → exit 0, 0 errors.
  • pnpm turbo run build --filter='./packages/*' from clean → app-shell fails (37 successful, 1 failed). Same in CI Bundle Analysis (re-run reproduced).
  • All errors are module-resolution for plugin-* packages app-shell does declare as deps; none are in PR-specific code.

Likely root cause

plugin-* packages build via vite build; app-shell's tsc needs their .d.ts. Under turbo's parallel build the .d.ts for some plugin-* packages isn't reliably present/ready when app-shell's tsc runs (vite dts emit timing / declaration outputs not declared as turbo outputs for cache-correct ordering). app-shell's tsconfig references only 6 composite packages; the plugin-* deps resolve via node module resolution against dist.

Suggested directions (pick one)

  1. Ensure every plugin-* vite build emits .d.ts and declares it in turbo outputs so ordering/caching is correct.
  2. Switch app-shell's build off composite tsc to the same vite build the plugin packages use.
  3. Add the plugin-* packages to app-shell tsconfig.references (requires they be composite).

Impact

Blocks the "all-green" bar for any PR that changes an app-shell dependency, even when the PR's own code is correct (e.g. #1757, verified via Build & E2E + in-browser). Surfaced by objectstack-ai/objectstack#1890 / #1757.

Activity

  1. os-zhuang commented on Jun 15, 2026

    @os-zhuang
    ContributorAuthor

    Diagnosis (upgraded from "likely" to confirmed direction)

    Confirmed structural anomaly. plugin-* packages generate .d.ts via vite-plugin-dts ^5 configured with compilerOptions: { rootDir: resolve(__dirname, '../..') } (the monorepo root) + resolve.alias mapping @object-ui/* to each package's src + skipDiagnostics: true. Result: a deeply nested dist layout —

    packages/plugin-charts/dist/index.d.ts            → export * from './packages/plugin-charts/src/index.js'
    packages/plugin-charts/dist/packages/plugin-charts/src/*.d.ts
    

    i.e. every plugin's dts emit walks cross-package src type graphs (via the aliases) and writes a root-anchored nested tree.

    Confirmed flaky (not a stable config error). #1764 changed an app-shell dependency → app-shell must rebuild (cache miss) → yet it went green; #1757 (same app-shell code) went red. So a rebuild of app-shell succeeds sometimes and fails others → a concurrency race, masked the rest of the time by turbo cache.

    Root cause (high confidence). Under a full parallel turbo run build, vite-plugin-dts generating the nested + cross-package-src .d.ts for ~15 plugins concurrently is unstable (cross-package src analysis load + race / late flush), so app-shell's composite tsc intermittently can't resolve some plugin's .d.ts (Cannot find module '@object-ui/plugin-*'). Running app-shell build in isolation (deps' dist already present) always succeeds — consistent with the race.

    Fix options (need verification with repeated full builds)

    1. Fix the dts rootDir to each package's src so emit is flat (dist/*.d.ts, no nested packages/.../src tree) and stops re-walking cross-package src — likely the smallest, highest-leverage change (apply across plugins).
    2. Replace vite-plugin-dts with a dedicated tsc --emitDeclarationOnly step (deterministic, turbo-trackable) for the declaration output.
    3. Switch app-shell off composite tsc to vite build (its own dts), removing the composite cross-package resolution requirement.

    Why not landed in this pass

    This is a flaky build-system fix: it needs a reliable turbo environment + several clean full builds to confirm the race is gone (a half-verified "fix" risks looking green while still flaky). My investigation worktree couldn't install turbo's platform binary reliably (Turborepo failed to start), and verifying flakiness needs repeated slow builds. Best done as a focused pass. Diagnosis + fix options recorded here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions