Почему создаётся стандартная ошибка вместо кастомной?

В проекте используется laravel-mix у которого в зависимостях package.json:

  "dependencies": {
    "autoprefixer": "^7.2.6",
    "babel-core": "^6.24.1",
    "babel-loader": "^7.1.1",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-preset-env": "^1.5.1",
    "chokidar": "^2.0.3",
    "clean-css": "^4.1.3",
    "concatenate": "0.0.2",
    "css-loader": "^0.28.9",
    "dotenv": "^4.0.0",
    "dotenv-expand": "^4.2.0",
    "extract-text-webpack-plugin": "^3.0.2",
    "file-loader": "^0.11.2",
    "friendly-errors-webpack-plugin": "^1.6.1",
    "fs-extra": "^3.0.1",
    "glob": "^7.1.2",
    "html-loader": "^0.4.5",
    "img-loader": "^3.0.0",
    "lodash": "^4.17.5",
    "md5": "^2.2.1",
    "node-sass": "^4.9.0",
    "postcss-loader": "^2.1.0",
    "resolve-url-loader": "^2.2.1",
    "sass-loader": "^6.0.5",
    "style-loader": "^0.18.2",
    "uglify-js": "^2.8.29",
    "uglifyjs-webpack-plugin": "^1.1.8",
    "vue-loader": "^13.7.1",
    "vue-template-compiler": "^2.5.13",
    "webpack": "^3.11.0",
    "webpack-chunk-hash": "^0.4.0",
    "webpack-dev-server": "^2.11.1",
    "webpack-merge": "^4.1.0",
    "webpack-notifier": "^1.5.1",
    "yargs": "^8.0.2"
  },

Создаю класс кастомного исключения:

{
  class DefaultShapeException extends Error {
    constructor(message) {
      super(message);
      this.name = this.constructor.name;
    }
  }

  class ShapeException extends DefaultShapeException {
    constructor(message) {
      super(message);
    }
  }
  
  try {
    const ex = new ShapeException();
    console.log(ex instanceof ShapeException);
    console.dir(ex);
  } catch (ex) {

  }
  
}

который в консоле Google Chrome (и в снипете) отрабатывает корректно, т.е. ex instanceof ShapeException говорит true.

Но в проекте говорит false. Предполагаю, что это транспилятор косячит, но не могу понять как. Кто-то сталкивался с подобной проблемой?

UPD

Что генерирует транспилятор:

function _possibleConstructorReturn(self, call) {
  if (!self) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call && (typeof call === "object" || typeof call === "function") ? call : self;
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

function _inherits(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, {
    constructor: {
      value: subClass,
      enumerable: false,
      writable: true,
      configurable: true
    }
  });
  if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}

{
  {
    var DefaultShapeException = function(_Error) {
      _inherits(DefaultShapeException, _Error);

      function DefaultShapeException(message) {
        _classCallCheck(this, DefaultShapeException);

        var _this = _possibleConstructorReturn(this, (DefaultShapeException.__proto__ || Object.getPrototypeOf(DefaultShapeException)).call(this, message));

        _this.name = _this.constructor.name;
        return _this;
      }

      return DefaultShapeException;
    }(Error);

    var ShapeException = function(_DefaultShapeExceptio) {
      _inherits(ShapeException, _DefaultShapeExceptio);

      function ShapeException(message) {
        _classCallCheck(this, ShapeException);

        return _possibleConstructorReturn(this, (ShapeException.__proto__ || Object.getPrototypeOf(ShapeException)).call(this, message));
      }

      return ShapeException;
    }(DefaultShapeException);

    try {
      var ex = new ShapeException();
      console.log(ex instanceof ShapeException);
      console.dir(ex);
    } catch (ex) {}
  }
}

Ответы (0 шт):