{"id":20621,"library":"ts-config-webpack-plugin","title":"ts-config-webpack-plugin","description":"A webpack plugin that automates TypeScript loader configuration using ts-loader, thread-loader, and fork-ts-checker-webpack-plugin with sensible defaults for development and production builds. Version 2.0.3 requires webpack >=4.36.0 and TypeScript >=3.1.0. Part of the common-config-webpack-plugin suite, it adjusts settings based on webpack mode. Key differentiator: zero-config TypeScript webpack loader setup with multi-threaded compilation and type checking.","status":"active","version":"2.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/merkle-open/webpack-config-plugins","tags":["javascript","ts-loader","typescript-loader","webpack","loader","typescript","ts"],"install":[{"cmd":"npm install ts-config-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add ts-config-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add ts-config-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for plugin integration","package":"webpack","optional":true},{"reason":"peer dependency for TypeScript compilation","package":"typescript","optional":true}],"imports":[{"note":"This package does not ship TypeScript types and uses module.exports, so CommonJS require() is the standard. ESM import may fail in Node.js without special configuration.","wrong":"import TsConfigWebpackPlugin from 'ts-config-webpack-plugin';","symbol":"TsConfigWebpackPlugin","correct":"const TsConfigWebpackPlugin = require('ts-config-webpack-plugin');"},{"note":"While the package does not natively support ESM, some bundlers may handle default import. Named destructured require is incorrect because the plugin is exported directly as the constructor.","wrong":"const { TsConfigWebpackPlugin } = require('ts-config-webpack-plugin');","symbol":"TsConfigWebpackPlugin (default import)","correct":"import TsConfigWebpackPlugin from 'ts-config-webpack-plugin';"},{"note":"The package does not export TypeScript types; use JSDoc for type hints if needed.","wrong":"import type { TsConfigWebpackPlugin } from 'ts-config-webpack-plugin';","symbol":"TsConfigWebpackPlugin (type)","correct":"// No type imports available. Use:\n/** @type {import('ts-config-webpack-plugin')} */"}],"quickstart":{"code":"const TsConfigWebpackPlugin = require('ts-config-webpack-plugin');\nconst path = require('path');\n\nmodule.exports = {\n  mode: 'development',\n  entry: './src/index.ts',\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  resolve: {\n    extensions: ['.ts', '.js'],\n  },\n  plugins: [\n    new TsConfigWebpackPlugin()\n  ]\n};","lang":"javascript","description":"Minimal webpack config using ts-config-webpack-plugin to compile TypeScript with ts-loader and thread-loader in development mode."},"warnings":[{"fix":"Remove mode from options and set webpack mode in the config directly. If you must override, use webpack's mode or set process.env.NODE_ENV.","message":"Version 2.x changed the plugin API; the constructor no longer accepts a single options object with mode property; use new TsConfigWebpackPlugin(options) where options may include configFile but mode is derived from webpack mode.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Ensure a valid tsconfig.json exists at the project root or provide an explicit configFile option.","message":"The option `configFile` fallback to src/config/tsconfig.base.json is deprecated and will be removed in a future version.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Use webpack 4 for guaranteed compatibility, or manually update loader versions if using webpack 5.","message":"The plugin does not work with webpack 5 out of the box; it may require additional configuration or updates to peer dependencies.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Disable thread-loader by configuring the plugin with `threadLoader: false` (not officially documented; inspect plugin source or use custom loader configuration).","message":"thread-loader is automatically injected but may cause issues with certain TypeScript features like emitDecoratorMetadata.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Consider using ts-loader directly with thread-loader and fork-ts-checker-webpack-plugin for more control and active maintenance.","message":"The package is part of the common-config-webpack-plugin suite which has not been updated recently; check for newer alternatives like ts-loader or babel-loader with TypeScript directly.","severity":"deprecated","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev ts-config-webpack-plugin' or add it to devDependencies.","cause":"Package not installed or missing from node_modules.","error":"Error: Cannot find module 'ts-config-webpack-plugin'"},{"fix":"Use 'const TsConfigWebpackPlugin = require('ts-config-webpack-plugin');' or 'import TsConfigWebpackPlugin from 'ts-config-webpack-plugin';' (if bundler supports it).","cause":"Importing the plugin incorrectly (e.g., named import instead of default).","error":"TypeError: TsConfigWebpackPlugin is not a constructor"},{"fix":"Run 'npm install --save-dev typescript' or install a compatible version.","cause":"TypeScript is not installed as a peer dependency.","error":"Error: Cannot find module 'typescript'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}