fork-ts-checker-webpack-plugin icon indicating copy to clipboard operation
fork-ts-checker-webpack-plugin copied to clipboard

Catch webpack failures

Open onigoetz opened this issue 7 months ago • 0 comments

Hi,

I'm using fork-ts-checker-webpack-plugin along with eslint-webpack-plugin.

The latest version of eslint-webpack-plugin now throws an error when linting errors are found; which looks like this in the console:

[22:04:03] Starting 'js_myTSBundle' ...

  Failed to compile.

[22:04:04] 'js_myTSBundle' errored after 727 ms
[22:04:04]  
/Users/onigoetz/Sites/Libs/crafty/packages/integration/fixtures/crafty-preset-typescript-webpack/invalid-forked/js/typescript.ts
  19:9   error  Unexpected alert                    no-alert
  20:1   error  Delete `··`                         @swissquote/swissquote/prettier/prettier

✖ 18 problems (16 errors, 2 warnings)
  13 errors and 0 warnings potentially fixable with the `--fix` option.

[22:04:04] 'js' errored after 728 ms
[22:04:04] 'default' errored after 730 ms
Issues checking service aborted - probably out of memory. Check the `memoryLimit` option in the ForkTsCheckerWebpackPlugin configuration.
If increasing the memory doesn't solve the issue, it's most probably a bug in the TypeScript.

I get a warning by ForkTsCheckerWebpackPlugin that it may be a memoryLimit error even though it's due to the linting error above.

I don't know how to approach fixing this so this PR is an attempt at it; catch a failed hook from webpack and avoid printing the error if that's the case.

I don't know how to test this and I don't know if this approach actually prevents the intended use case which is to detect out of memory and print an informative message. I'd appreciate guidance so that we can find a way to print the message only when relevant.

onigoetz avatar May 12 '25 20:05 onigoetz