Skip to content

Worker crash (OOM / SIGABRT) does not fail the webpack build #883

@omer-feinberg-island

Description

@omer-feinberg-island

Current behavior

When the type checker worker process crashes (e.g., due to an out-of-memory error), the build completes successfully with exit code 0. The crash is logged to the console but is never propagated to compilation.errors.

Expected behavior

Build should fail with a non-zero exit code when the type checker worker crashes.

Steps to reproduce the issue

Create the following files:

package.json:

  {
    "private": true,
    "devDependencies": {
      "typescript": "^5.0.0",
      "webpack": "^5.0.0",
      "webpack-cli": "^5.0.0",
      "ts-loader": "^9.0.0",
      "fork-ts-checker-webpack-plugin": "9.1.0"
    }
  }

tsconfig.json:

  {
    "compilerOptions": {
      "target": "ES2020",
      "module": "ESNext",
      "moduleResolution": "node",
      "strict": true,
      "outDir": "dist"
    },
    "include": ["src"]
  }

webpack.config.js:

  const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');

  module.exports = {
    mode: 'production',
    entry: './src/index.ts',
    output: {
      filename: 'bundle.js',
      path: __dirname + '/dist',
    },
    resolve: {
      extensions: ['.ts', '.js'],
    },
    module: {
      rules: [
        {
          test: /\.ts$/,
          loader: 'ts-loader',
          options: { transpileOnly: true },
        },
      ],
    },
    plugins: [
      new ForkTsCheckerWebpackPlugin({
        typescript: {
          memoryLimit: 100,
        },
      }),
    ],
  };

src/index.ts:

  export const x = 1;

Run:
npm install && npx webpack

Output:

  RpcExitError: Process 89674 exited [SIGABRT]
  Issues checking service aborted - probably out of memory. ...
  asset bundle.js 0 bytes [emitted] [minimized] (name: main)
  webpack 5.105.0 compiled successfully in 720 ms
  # exit code: 0

Environment

  • fork-ts-checker-webpack-plugin: 9.1.0
  • typescript: 5.7.3
  • eslint: N/A
  • webpack: 5.105.0
  • os: macOS Darwin 24.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions