ts-checker-rspack-plugin

Runs TypeScript type checking in a separate process so Rspack builds and dev-server rebuilds stay fast.

Tool
npm
v1.6.1
28stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
73/100Good
Development Activity96
Maintenance100
Community32
Maturity44
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture85
Code Quality82
Innovation68
Learning Curve80

ts-checker-rspack-plugin moves TypeScript type checking off the main Rspack compilation thread and into a dedicated worker process, so type errors surface without slowing down every rebuild. It is a direct successor to fork-ts-checker-webpack-plugin, rebuilt specifically for Rspack’s compiler hooks and lite-tapable plugin system.

The plugin supports both the classic TypeScript compiler API (via a pooled RPC worker) and TypeScript 7+‘s native tsgo checker, which it can enable automatically when a compatible typescript package is detected. Diagnostics can be reported synchronously (blocking the build) or asynchronously (reported after compilation finishes, ideal for watch mode), and issues can be filtered, have their severity overridden, or be rendered through a code-frame, basic, or fully custom formatter.

Because it drives its own module resolution through the TypeScript compiler rather than Rspack’s resolver, it respects tsconfig.json project references and incremental builds exactly as tsc would, while still integrating with Rspack’s dev-server error overlay and infrastructure logger.

What You Get

  • A background worker (or native tsgo process for TypeScript 7+) that runs full TypeScript diagnostics without blocking Rspack’s own compilation
  • Async and sync reporting modes, selectable per environment, so watch mode isn’t held up by a full project type-check
  • Pluggable formatters (codeframe, basic, or a custom function) for rendering diagnostics in the terminal and in Rspack’s error output
  • Issue filtering and severity overrides via include/exclude matchers on file, code, and message
  • Project-references and incremental-build support that mirrors tsc --build semantics, including .tsbuildinfo and declaration output modes
  • Integration with Rspack’s dev-server error overlay and infrastructure logger out of the box

Common Use Cases

  • Adding real type-checking to a Rspack project that only transpiles TypeScript with builtin:swc-loader or ts-loader (which strip types without checking them)
  • Keeping local dev-server rebuilds fast by reporting type errors asynchronously instead of blocking every save
  • Enforcing type-check-clean production builds by running the plugin in synchronous/build mode in CI
  • Adopting TypeScript 7’s native tsgo checker on large monorepos to cut down type-checking time without changing the build pipeline
  • Filtering out noisy third-party or generated-file diagnostics via issue.include/issue.exclude while still failing the build on app-source errors

Under The Hood

Architecture The plugin’s apply() method (src/plugin.ts) builds a config object via createPluginConfig, then branches on whether TypeScript 7+‘s native tsgo checker is available. In the classic path it spins up two pooled RPC workers — getIssuesWorker and getDependenciesWorker — communicating over src/rpc/rpc-worker.ts, and taps Rspack’s compiler lifecycle through small, single-purpose hook modules under src/hooks/ (tap-start-to-run-workers, tap-after-compile-to-add-dependencies, tap-stop-to-terminate-workers, tap-error-to-log-message). The tsgo path instead taps a dedicated tap-start-to-run-type-script-go hook that shells out to the native checker binary. Each hook owns one lifecycle concern, so the composition in apply() reads like a pipeline rather than a monolithic plugin class; a shared plugin-state.ts object threads status between hooks without global mutation.

Tech Stack The project is TypeScript-first (99%+ of the codebase), targeting Rspack ^1.0.0/^2.0.0 as a peer dependency and TypeScript >=3.8.0 (with special-cased support for TypeScript 7’s native preview). It depends on @rspack/lite-tapable for hook typing, chokidar for file watching, memfs for an in-memory virtual file system used by the TypeScript worker, and picocolors for terminal output. The monorepo is built and tested with the rstack CLI (the rstackjs org’s own build/test/lint tool) under a pnpm workspace, and ships compiled output from lib/ per package.json’s files field.

Code Quality The test suite (test/unit/, ~22 files) covers formatters, issue matching/predicates, hooks, the watch file system, and the RPC layer, with a separate test/e2e/ suite exercising real Rspack and Rsbuild projects end-to-end. Error handling is explicit and typed: tap-error-to-log-message.ts distinguishes AbortError (silently ignored) from RpcExitError (parsed by signal to give actionable messages about worker memory limits), rather than swallowing worker failures generically. Naming is consistent and descriptive (tap-<phase>-to-<action>.ts for every hook file), and the codebase leans on TypeScript’s type system throughout with no any-heavy shortcuts visible in the core plugin files reviewed.

What Makes It Unique Unlike checkers that re-implement module resolution to match the bundler, this plugin deliberately uses TypeScript’s own module resolution instead of Rspack’s — trading some behavioral surprises (documented explicitly in the README) for faster resolution and closer fidelity to what tsc itself would report. Its handling of TypeScript 7’s native tsgo checker — auto-detecting the installed TypeScript major version and falling back to @typescript/native-preview only for compatibility — positions it to absorb TypeScript’s move to a native checker without requiring a config rewrite from consumers.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search