Registry / devops / ts-config-webpack-plugin

ts-config-webpack-plugin

JSON →
library2.0.3jsnpmunverified

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.

npm install ts-config-webpack-plugin
INSTALL
IMPORT
SIG · TS-CONFIG-WEBPACK-
T
ts-config-webpack-plugin
devopsjavascriptv2.0.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TsConfigWebpackPlugin
const TsConfigWebpackPlugin = require('ts-config-webpack-plugin');
import TsConfigWebpackPlugin from 'ts-config-webpack-plugin';
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.
TsConfigWebpackPlugin (default import)
import TsConfigWebpackPlugin from 'ts-config-webpack-plugin';
const { TsConfigWebpackPlugin } = require('ts-config-webpack-plugin');
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.
TsConfigWebpackPlugin (type)
// No type imports available. Use: /** @type {import('ts-config-webpack-plugin')} */
import type { TsConfigWebpackPlugin } from 'ts-config-webpack-plugin';
The package does not export TypeScript types; use JSDoc for type hints if needed.

Minimal webpack config using ts-config-webpack-plugin to compile TypeScript with ts-loader and thread-loader in development mode.

const TsConfigWebpackPlugin = require('ts-config-webpack-plugin'); const path = require('path'); module.exports = { mode: 'development', entry: './src/index.ts', output: { path: path.resolve(__dirname, 'dist'), filename: 'bundle.js', }, resolve: { extensions: ['.ts', '.js'], }, plugins: [ new TsConfigWebpackPlugin() ] };
Debug
Known issues
breakingVersion 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.
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.
affects: >=2.0.0
deprecatedThe option `configFile` fallback to src/config/tsconfig.base.json is deprecated and will be removed in a future version.
fix
Ensure a valid tsconfig.json exists at the project root or provide an explicit configFile option.
affects: >=2.0.0
gotchaThe plugin does not work with webpack 5 out of the box; it may require additional configuration or updates to peer dependencies.
fix
Use webpack 4 for guaranteed compatibility, or manually update loader versions if using webpack 5.
affects: >=2.0.0
gotchathread-loader is automatically injected but may cause issues with certain TypeScript features like emitDecoratorMetadata.
fix
Disable thread-loader by configuring the plugin with `threadLoader: false` (not officially documented; inspect plugin source or use custom loader configuration).
affects: >=2.0.0
deprecatedThe 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.
fix
Consider using ts-loader directly with thread-loader and fork-ts-checker-webpack-plugin for more control and active maintenance.
affects: >=2.0.0
Errors
Common errors & fixes
Error: Cannot find module 'ts-config-webpack-plugin'
Package not installed or missing from node_modules.
fix
Run 'npm install --save-dev ts-config-webpack-plugin' or add it to devDependencies.
TypeError: TsConfigWebpackPlugin is not a constructor
Importing the plugin incorrectly (e.g., named import instead of default).
fix
Use 'const TsConfigWebpackPlugin = require('ts-config-webpack-plugin');' or 'import TsConfigWebpackPlugin from 'ts-config-webpack-plugin';' (if bundler supports it).
Error: Cannot find module 'typescript'
TypeScript is not installed as a peer dependency.
fix
Run 'npm install --save-dev typescript' or install a compatible version.
Upgrade
Version history
2.0.3latest on npm
Audit
Dependencies
webpackoptionalpeer dependency for plugin integration
typescriptoptionalpeer dependency for TypeScript compilation
Agent activity
6 hits · last 30 days
node
6
Resources
ts-config-webpack-plugin — npm install ts-config-webpack-plugin · libregistry