tap-error-to-log-message.js 1.7 KB

1234567891011121314151617181920212223242526272829303132
  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. exports.tapErrorToLogMessage = void 0;
  7. const chalk_1 = __importDefault(require("chalk"));
  8. const plugin_hooks_1 = require("../plugin-hooks");
  9. const rpc_1 = require("../rpc");
  10. const abort_error_1 = require("../utils/async/abort-error");
  11. function tapErrorToLogMessage(compiler, config) {
  12. const hooks = (0, plugin_hooks_1.getPluginHooks)(compiler);
  13. hooks.error.tap('ForkTsCheckerWebpackPlugin', (error) => {
  14. if (error instanceof abort_error_1.AbortError) {
  15. return;
  16. }
  17. config.logger.error(String(error));
  18. if (error instanceof rpc_1.RpcExitError) {
  19. if (error.signal === 'SIGINT') {
  20. config.logger.error(chalk_1.default.red('Issues checking service interrupted - If running in a docker container, this may be caused ' +
  21. "by the container running out of memory. If so, try increasing the container's memory limit " +
  22. 'or lowering the `memoryLimit` value in the ForkTsCheckerWebpackPlugin configuration.'));
  23. }
  24. else {
  25. config.logger.error(chalk_1.default.red('Issues checking service aborted - probably out of memory. ' +
  26. 'Check the `memoryLimit` option in the ForkTsCheckerWebpackPlugin configuration.\n' +
  27. "If increasing the memory doesn't solve the issue, it's most probably a bug in the TypeScript."));
  28. }
  29. }
  30. });
  31. }
  32. exports.tapErrorToLogMessage = tapErrorToLogMessage;