fork-ts-checker-webpack-plugin: Build stops after `0.95 'emitting' 'fork-ts-checker-webpack-plugin'`

Current behavior

My webpack build gets to 95%, and after it emits ‘fork-ts-checker-webpack-plugin’ the build fails. Although the command exits with status 0, like a success, no build artefacts are generated. With the webpack logs, I see that it only ever gets to 95%, at this step.

yarn build
yarn run v1.19.1
$ node ./scripts/build_client.js
Ready to start the build.

Creating an optimized production build...
0 'compiling'
0.1 'building' '0/0 modules' '0 active' ''
0.1 'building' '0/1 modules' '1 active' 'multi /home/circleci/project/src/index.tsx'
0.10120000000000001 'building' '1/1 modules' '0 active' ''
...
0.930392156862745 'after chunk asset optimization' 'SourceMapDevToolPlugin'
0.9352941176470588 'asset optimization'
0.9401960784313725 'after asset optimization'
0.9450980392156862 'after seal'
0.95 'emitting'
0.95 'emitting' '@loadable/webpack-plugin'
0.95 'emitting' 'HtmlWebpackPlugin'
0.95 'emitting' 'GenerateSW'
0.95 'emitting' 'fork-ts-checker-webpack-plugin'
 

This is the end of the logs, no artefacts are outputted. That is the build folder is empty.

Expected behaviour

The build continues to 100% and the artefacts are outputted.

Steps to reproduce the issue

I am using a forked version of CRA, but I just run yarn build and get this situation.

Here is a sample from my config. Full config is here.

const ForkTsCheckerWebpackPlugin = require("react-dev-utils/ForkTsCheckerWebpackPlugin");

new ForkTsCheckerWebpackPlugin({
  typescript: resolve.sync("typescript", {
    basedir: paths.appNodeModules
  }),
  async: isEnvDevelopment,
  useTypescriptIncrementalApi: true,
  checkSyntacticErrors: true,
  resolveModuleNameModule: process.versions.pnp
    ? `${__dirname}/pnpTs.js`
    : undefined,
  resolveTypeReferenceDirectiveModule: process.versions.pnp
    ? `${__dirname}/pnpTs.js`
    : undefined,
  tsconfig: paths.appTsConfig,
  reportFiles: [
    "**",
    "!**/__tests__/**",
    "!**/?(*.)(spec|test).*",
    "!**/src/setupProxy.*",
    "!**/src/setupTests.*"
  ],
  watch: [paths.appServer, paths.appSrc],
  silent: true,
  // The formatter is invoked directly in WebpackDevServerUtils during development
  formatter: isEnvProduction ? typescriptFormatter : undefined
});

Environment

  • fork-ts-checker-webpack-plugin: react-dev-utils/ForkTsCheckerWebpackPlugin (“react-dev-utils”: “^9.0.1”,)
  • typescript: “typescript”: “3.4.5”,
  • webpack: “webpack”: “4.29.6”,
  • os: circleci

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 10
  • Comments: 25 (13 by maintainers)

Commits related to this issue

Most upvoted comments

FWIW, I was tracking this issue as well. I had been seeing this on CircleCI builds in production. I had seen a hint that it may have been related to a poorly (or unreported) out of memory exception inside of webpack. After upgrading to the latest build of webpack and related build tooling, the issue seems to have resolved itself.

I was finally able to track down! Turns out there’s two different out of memory errors you can run into for node processes, in a docker container on circleci. The first is if an individual process exceedes the limit imposed by node via the --max_old_space_size option. In that case, node kills the process and throws an OOM exception that is pretty obvious. fork-ts-checker-webpack-plugin actually detects the kill signal for this and alerts you. The second is if you set the --max_old_space_size value too high and the overall memory usage of the docker container surpasses the 4GB limit imposed by circleci. In this case docker starts silently killing processes. It seems to kill them with a SIGINT, but it doesn’t seem to throw any type of OOM exception, as far as I can tell, so the process just silently dies. I was able to fix this by setting the memory limit for both webpack and fork-ts-checker-webpack-plugin to 1400MB.

nuxt.config.js So I closed the typescript check buildModules: [ [ '@nuxt/typescript-build', { typeCheck: false } ] ]