npm build 在 Class 上失败 extends value undefined is not a constructor or null

npm build failing on Class extends value undefined is not a constructor or null

我已经查看了类似问题的其他答案,但我对 npm 不够熟悉,无法将它们翻译成我所看到的。我正在尝试构建一个项目,但出现错误:

     ERROR  TypeError: Class extends value undefined is not a constructor or null
TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (D:\Development\Website\prosystem88\node_modules\mini-css-extract-plugin\dist\CssDependency.js:12:46)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (D:\Development\Website\prosystem88\node_modules\mini-css-extract-plugin\dist\index.js:12:45)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)

...还有更多内容,但我认为这是唯一相关的部分,如果不是请告诉我

index.js地区:

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _webpack = _interopRequireDefault(require("webpack"));

var _webpackSources = _interopRequireDefault(require("webpack-sources"));

var _CssDependency = _interopRequireDefault(require("./CssDependency"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

CssDependency.js

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _webpack = _interopRequireDefault(require("webpack"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

class CssDependency extends _webpack.default.Dependency {
  constructor({
    identifier,
    content,
    media,
    sourceMap
  }, context, identifierIndex) {
    super();
    this.identifier = identifier;
    this.identifierIndex = identifierIndex;
    this.content = content;
    this.media = media;
    this.sourceMap = sourceMap;
    this.context = context;
  }

  getResourceIdentifier() {
    return `css-module-${this.identifier}-${this.identifierIndex}`;
  }

}

exports.default = CssDependency;

我不断收到这可能是循环依赖的信息,但我不明白在这种情况下是怎么回事。任何指示都会有所帮助。

我已经尝试了多种不同的小东西,但我对这个构建过程和 npm 感到很困惑,我担心我会搞砸整个项目。

在这种情况下,问题是 mini-css-extract-plugin 需要 webpack >= 4.1.0

Source