static buildError(error, file, sourceMap, requestShortener) {
    /**
     * @type {Error & { file?: string }}
     */
    let builtError;

    if (typeof error === "string") {
      builtError = new Error(`${file} from Terser plugin\n${error}`);
      builtError.file = file;

      return builtError;
    }

    if (error.line) {
      const original =
        sourceMap &&
        getTraceMapping().originalPositionFor(sourceMap, {
          line: error.line,
          column: error.col,
        });

      if (original && original.source && requestShortener) {
        builtError = new Error(
          `${file} from Terser plugin\n${
            error.message
          } [${requestShortener.shorten(original.source)}:${original.line},${
            original.column
          }][${file}:${error.line},${error.col}]${
            error.stack
              ? `\n${error.stack.split("\n").slice(1).join("\n")}`
              : ""
          }`
        );
        builtError.file = file;

        return builtError;
      }

      builtError = new Error(
        `${file} from Terser plugin\n${error.message} [${file}:${error.line},${
          error.col
        }]${
          error.stack ? `\n${error.stack.split("\n").slice(1).join("\n")}` : ""
        }`
      );
      builtError.file = file;

      return builtError;
    }

    if (error.stack) {
      builtError = new Error(
        `${file} from Terser plugin\n${
          typeof error.message !== "undefined" ? error.message : ""
        }\n${error.stack}`
      );
      builtError.file = file;

      return builtError;
    }

    builtError = new Error(`${file} from Terser plugin\n${error.message}`);
    builtError.file = file;

    return builtError;
  }
@private
@param {any} error
@param {string} file
@param {TraceMap} [sourceMap]
@param {Compilation["requestShortener"]} [requestShortener]
@returns {Error}