{"id":12166,"library":"ts-checker-rspack-plugin","title":"Rspack TypeScript Checker Plugin","description":"The ts-checker-rspack-plugin is an essential Rspack plugin designed to accelerate TypeScript type checking by offloading it to a separate process. This approach significantly improves build performance, especially in larger projects. Currently stable at version 1.3.0, the package maintains an active release cadence, with frequent minor and patch updates addressing bug fixes, performance enhancements, and dependency updates. Key differentiators include its robust support for modern TypeScript features like project references and incremental mode, a visually appealing code frame formatter for error messages, and its origin as a fork of the widely used `fork-ts-checker-webpack-plugin`, specifically adapted for the Rspack ecosystem. It requires Node.js >=16.0.0+, Rspack ^1.0.0 || ^2.0.0-0, and TypeScript >=3.8.0 as peer dependencies.","status":"active","version":"1.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/rstackjs/ts-checker-rspack-plugin","tags":["javascript","rspack","plugin","typescript","typecheck"],"install":[{"cmd":"npm install ts-checker-rspack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add ts-checker-rspack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add ts-checker-rspack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required as the core bundling tool for which this plugin provides type-checking functionality.","package":"@rspack/core","optional":false},{"reason":"The plugin leverages TypeScript's compiler API for type checking.","package":"typescript","optional":false}],"imports":[{"note":"The plugin class is a named export, not a default export. Ensure you use curly braces for import.","wrong":"import TsCheckerRspackPlugin from 'ts-checker-rspack-plugin';","symbol":"TsCheckerRspackPlugin","correct":"import { TsCheckerRspackPlugin } from 'ts-checker-rspack-plugin';"},{"note":"When using CommonJS, the plugin is a named export requiring destructuring from the `require` call.","wrong":"const TsCheckerRspackPlugin = require('ts-checker-rspack-plugin');","symbol":"TsCheckerRspackPlugin (CommonJS)","correct":"const { TsCheckerRspackPlugin } = require('ts-checker-rspack-plugin');"},{"note":"While not explicitly shown in the README, for advanced TypeScript usage, you might import the `Options` type to get IntelliSense for plugin configuration.","symbol":"Plugin options type (example)","correct":"import type { Options } from 'ts-checker-rspack-plugin';"}],"quickstart":{"code":"import { TsCheckerRspackPlugin } from 'ts-checker-rspack-plugin';\n\nexport default {\n  entry: './src/index.ts',\n  resolve: {\n    extensions: ['.ts', '.tsx', '.js'],\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.tsx?$/,\n        loader: 'builtin:swc-loader',\n        options: {\n          jsc: {\n            parser: {\n              syntax: 'typescript',\n              tsx: true // Enable TSX parsing if you're using React/Preact with TypeScript\n            },\n            transform: {\n                react: {\n                    runtime: 'automatic'\n                }\n            }\n          },\n          // Optional: specify target environment for SWC to match your project's browserlist/targets\n          env: {\n            targets: ['chrome 90', 'safari 15', 'firefox 90']\n          }\n        },\n      },\n    ],\n  },\n  plugins: [\n    new TsCheckerRspackPlugin({\n      // Optional: specify your tsconfig.json file path if it's not at the root\n      typescript: {\n        configFile: './tsconfig.json'\n      },\n      // Optional: Enable async mode for non-blocking type checking (default is false)\n      async: false\n    })\n  ],\n  // Performance optimization: prevent the plugin from infinitely rebuilding\n  output: {\n    path: './dist'\n  }\n};","lang":"typescript","description":"This quickstart demonstrates a minimal Rspack configuration integrating the ts-checker-rspack-plugin for TypeScript type checking with SWC loader, showing both basic setup and common configurations like tsconfig path and async mode."},"warnings":[{"fix":"Upgrade `ts-checker-rspack-plugin` to version `1.2.4` or higher. Ensure your `@rspack/core` version matches `^1.0.0 || ^2.0.0-0`.","message":"The plugin updated its peer dependency to officially support `@rspack/core` v2. Users upgrading Rspack to v2 should update ts-checker-rspack-plugin to v1.2.4 or newer to ensure compatibility and correct behavior.","severity":"breaking","affected_versions":"<1.2.4"},{"fix":"Carefully configure your `tsconfig.json` (especially `baseUrl`, `paths`, `include`, and `exclude`). Use `tsc --traceResolution` to debug TypeScript's module resolution when issues arise.","message":"This plugin utilizes TypeScript's internal module resolution logic, not Rspack's. Incorrect `tsconfig.json` configurations for paths or includes can lead to missing type errors or slow performance, even if Rspack's module resolution is correctly set up.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Review the plugin's documentation on performance optimization and incremental mode. Consider alternative strategies for faster rebuilds if previously relying solely on TypeScript's build mode. For Rsbuild projects, consider `@rsbuild/plugin-type-check`.","message":"As of v1.2.4, the README no longer recommends TypeScript's 'Build mode' (`--build` or `incremental`) for incremental builds directly with this plugin, suggesting that other approaches might be more performant or reliable.","severity":"deprecated","affected_versions":">=1.2.4"},{"fix":"Upgrade `ts-checker-rspack-plugin` to version `1.1.7` or newer to ensure the fix is applied and prevent rebuild loops by correctly excluding output paths.","message":"Versions prior to `1.1.7` could lead to an infinite rebuild loop due to incorrect output path exclusion, severely impacting build performance and stability.","severity":"breaking","affected_versions":"<1.1.7"},{"fix":"Ensure your development environment and CI/CD pipelines are using Node.js version 16.0.0 or newer. Update Node.js if necessary.","message":"The plugin requires Node.js version 16.0.0 or higher. Using an older Node.js version will result in errors or unexpected behavior during installation or execution.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Verify your `tsconfig.json` settings, specifically `baseUrl`, `paths`, `include`, and `exclude`. The plugin relies on TypeScript's own resolution, not Rspack's. Run `tsc --traceResolution` to debug TypeScript's module resolution.","cause":"TypeScript is unable to resolve types or modules, often due to a misconfigured `tsconfig.json` that doesn't align with the project structure or uses incorrect path mappings.","error":"ERROR in <file>: Cannot find name 'MyComponentProps'."},{"fix":"For ES Modules, ensure `import { TsCheckerRspackPlugin } from 'ts-checker-rspack-plugin';` is used. For CommonJS, use `const { TsCheckerRspackPlugin } = require('ts-checker-rspack-plugin');`.","cause":"Attempting to use `new TsCheckerRspackPlugin()` without correctly importing the named export. This often happens when mixing CommonJS `require` with `import` syntax or incorrect destructuring.","error":"TypeError: TsCheckerRspackPlugin is not a constructor"},{"fix":"Ensure the `tsconfig.json` file specified for the plugin via `typescript.configFile` (if any) and its `include`/`exclude` options cover all your source files. Double-check that `tsconfig.json` is consistent between your Rspack configuration and standalone `tsc` commands.","cause":"The plugin's configuration (or the `tsconfig.json` it uses) might not be checking all necessary files or directories, leading to a discrepancy between the plugin's output and a direct `tsc` run.","error":"Rspack build finishes without type errors, but 'tsc --noEmit' reports errors."}],"ecosystem":"npm"}