Skip to content

engine: tsbuildinfo cache prevents incremental rebuild after clean #285

Description

@bpowers

Problem

The engine build script (src/engine/build.sh) deletes the output directories lib/ and lib.browser/ before running incremental TypeScript compilation (line 39). However, it does not delete the corresponding TypeScript incremental cache files: tsconfig.tsbuildinfo and tsconfig.browser.tsbuildinfo.

This causes TypeScript's incremental mode to incorrectly believe the outputs are up-to-date (because the cache still points to the deleted files), so the compiler skips compilation entirely. The output directories remain empty (except for WASM files copied later), causing downstream packages like @simlin/core to fail with missing type declarations.

Why it matters

The incremental build is designed to speed up builds by skipping unchanged files. But when outputs are deleted without clearing the cache, incremental mode becomes inconsistent with reality. This leads to:

  • Silent build failures with confusing error messages downstream
  • Broken CI/local builds after cache corruption
  • Harder debugging (appears to be a missing dependency, not a build issue)

Affected component

  • src/engine/build.sh (build script)
  • Downstream: @simlin/core and any package depending on @simlin/engine type declarations

Solution

Delete the tsbuildinfo cache files when deleting the output directories, so incremental compilation knows to rebuild from scratch:

# Before: just deletes outputs
rm -rf lib lib.browser

# After: also deletes incremental cache
rm -rf lib lib.browser tsconfig.tsbuildinfo tsconfig.browser.tsbuildinfo

This ensures incremental mode is consistent with the file system state.

Context

Identified while debugging build failures in the engine package after commit 876f4ee.

Activity

  1. added
    ciCI, build pipeline, test hygiene
    hygieneToil, but its useful to get get too behind on it
    on Jun 8, 2026
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

    ciCI, build pipeline, test hygienehygieneToil, but its useful to get get too behind on it

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions