tapErrorToLogMessage.js 1.6 KB

123456789101112131415161718192021222324252627
  1. "use strict";
  2. var __importDefault = (this && this.__importDefault) || function (mod) {
  3. return (mod && mod.__esModule) ? mod : { "default": mod };
  4. };
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. const pluginHooks_1 = require("./pluginHooks");
  7. const RpcIpcMessagePortClosedError_1 = require("../rpc/rpc-ipc/error/RpcIpcMessagePortClosedError");
  8. const chalk_1 = __importDefault(require("chalk"));
  9. function tapErrorToLogMessage(compiler, configuration) {
  10. const hooks = pluginHooks_1.getForkTsCheckerWebpackPluginHooks(compiler);
  11. hooks.error.tap('ForkTsCheckerWebpackPlugin', (error) => {
  12. configuration.logger.issues.error(String(error));
  13. if (error instanceof RpcIpcMessagePortClosedError_1.RpcIpcMessagePortClosedError) {
  14. if (error.signal === 'SIGINT') {
  15. configuration.logger.issues.error(chalk_1.default.red('Issues checking service interrupted - If running in a docker container, this may be caused ' +
  16. "by the container running out of memory. If so, try increasing the container's memory limit " +
  17. 'or lowering the `memoryLimit` value in the ForkTsCheckerWebpackPlugin configuration.'));
  18. }
  19. else {
  20. configuration.logger.issues.error(chalk_1.default.red('Issues checking service aborted - probably out of memory. ' +
  21. 'Check the `memoryLimit` option in the ForkTsCheckerWebpackPlugin configuration.\n' +
  22. "If increasing the memory doesn't solve the issue, it's most probably a bug in the TypeScript or EsLint."));
  23. }
  24. }
  25. });
  26. }
  27. exports.tapErrorToLogMessage = tapErrorToLogMessage;