Skip to content

chore: optimize tsconfig.json#28065

Merged
matallui merged 4 commits into
mainfrom
matallui/tsconfig-improvements
Mar 30, 2026
Merged

chore: optimize tsconfig.json#28065
matallui merged 4 commits into
mainfrom
matallui/tsconfig-improvements

Conversation

@matallui

@matallui matallui commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Description

The TypeScript language server (vtsls/tsserver) crashes or runs out of memory in editors when working on this repo. Root cause: two identical 741KB webpack bundles (scripts/inpage-bridge/dist/index.js and app/core/InpageBridgeWeb3.js) are included in the TypeScript project via include globs. These are minified single-line files that provide zero value to type-checking but force tsserver to parse ~759K characters and infer types for the entire bundled module graph.

This PR:

  1. Excludes the two 741KB bundles from type-checking by adding them to exclude — saves ~345MB peak RSS
  2. Enables incremental: true — allows tsc/tsserver to cache type information between runs. Warm runs drop from ~63s/7.4GB to ~10s/3.5GB
  3. Fixes .gitignore glob for .tsbuildinfo files — *.tsbuildinfo catches any filename generated by incremental builds

Benchmark results (10 iterations, measured with tsc --extendedDiagnostics + /usr/bin/time -l):

Config Peak RSS Total Time Errors
Baseline (scripts/**/*, no excludes) 7,422 MB 63.0s 0
+ Exclude both bundles 7,217 MB 66.8s 0
+ Exclude both bundles + incremental (cold) 7,330 MB 64.0s 0
+ Exclude both bundles + incremental (warm) 3,538 MB 10.2s 0

Note: The CI lint:tsc script already uses --max-old-space-size=8192 (8GB heap). Most editor LSPs default to 3-4GB, which is insufficient for this project's 17K+ file type graph. These changes reduce the memory footprint and dramatically improve warm startup times.

Changelog

CHANGELOG entry: null

Related issues

Fixes: N/A

Manual testing steps

Feature: TypeScript type-checking

  Scenario: tsc passes with no regressions
    Given the developer is at the repo root

    When developer runs `yarn lint:tsc`
    Then type-checking completes with zero errors

  Scenario: incremental compilation produces cache
    Given the developer is at the repo root
    And no tsconfig.tsbuildinfo file exists

    When developer runs `yarn lint:tsc` twice
    Then a tsconfig.tsbuildinfo file is created after the first run
    And the second run completes significantly faster (~10s vs ~60s)

  Scenario: excluded bundles are not type-checked
    Given the developer is at the repo root

    When developer runs `yarn tsc --listFiles --noEmit`
    Then the output does not contain scripts/inpage-bridge/dist/index.js
    And the output does not contain app/core/InpageBridgeWeb3.js

Screenshots/Recordings

N/A — configuration-only change with no UI impact.

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
Low risk configuration-only change; main impact is on editor/CI TypeScript type-check performance and the set of files included in type-checking.

Overview
Improves TypeScript developer ergonomics by enabling incremental compilation and updating .gitignore to ignore all generated *.tsbuildinfo caches.

Reduces tsserver/tsc load by excluding large bundled artifacts (app/core/InpageBridgeWeb3.js and scripts/inpage-bridge/dist) from the tsconfig.json project so they are no longer parsed/type-checked.

Written by Cursor Bugbot for commit d1d5673. This will update automatically on new commits. Configure here.

Enable incremental compilation and exclude two identical 741KB webpack
bundles (scripts/inpage-bridge/dist/index.js and app/core/InpageBridgeWeb3.js)
from type-checking. These minified single-line bundles provide no value to
tsc but consume ~345MB of memory and slow down both CI and editor LSPs.

Also fix .gitignore glob for tsbuildinfo files to match any filename
generated by incremental builds.
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-predict Predict team label Mar 27, 2026
@matallui matallui changed the title chore(devex): optimize tsconfig.json for LSP performance chore: optimize tsconfig.json Mar 27, 2026
@matallui matallui marked this pull request as ready for review March 27, 2026 22:39
@github-actions github-actions Bot added the risk-low Low testing needed · Low bug introduction risk label Mar 27, 2026
@github-actions github-actions Bot added risk-low Low testing needed · Low bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Mar 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: None (no tests recommended)
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 98%
click to see 🤖 AI reasoning details

E2E Test Selection:
The two changed files are purely build/tooling configuration:

  1. .gitignore: Changed .tsbuildinfo to *.tsbuildinfo — a glob pattern update to ignore all TypeScript incremental build cache files. No impact on app code or tests.

  2. tsconfig.json:

    • Enabled "incremental": true for faster TypeScript compilation (build optimization only).
    • Added app/core/InpageBridgeWeb3.js and scripts/inpage-bridge/dist to the TypeScript exclude list — these are already JS files/dist artifacts that don't need TS type-checking.

None of these changes affect application runtime behavior, UI components, controllers, navigation, or any user-facing functionality. They are purely developer tooling improvements (faster TS builds, cleaner gitignore). No E2E tests are warranted.

Performance Test Selection:
No performance impact. The changes only affect TypeScript compiler configuration (incremental builds) and .gitignore patterns. These are build-time optimizations with zero effect on app runtime performance, rendering, or any measured user flows.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@NicolasMassart NicolasMassart left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manual testing step uses npx tsc, which is disallowed by project guidelines. Please rewrite this description section.

Comment thread tsconfig.json
@matallui matallui enabled auto-merge March 30, 2026 15:29
@matallui matallui added this pull request to the merge queue Mar 30, 2026
Merged via the queue into main with commit 70c2952 Mar 30, 2026
66 checks passed
@matallui matallui deleted the matallui/tsconfig-improvements branch March 30, 2026 16:08
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 30, 2026
@metamaskbot metamaskbot added the release-7.73.0 Issue or pull request that will be included in release 7.73.0 label Mar 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.73.0 Issue or pull request that will be included in release 7.73.0 risk-low Low testing needed · Low bug introduction risk size-XS team-predict Predict team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants