鍍金池/ 問答/Linux  HTML/ 啟動(dòng)項(xiàng)目webpack報(bào)錯(cuò)?

啟動(dòng)項(xiàng)目webpack報(bào)錯(cuò)?

圖片描述
一個(gè)原來用vue-cli做的demo,今天啟動(dòng)時(shí)報(bào)錯(cuò),搞了半天不知道是什么原因?

回答
編輯回答
胭脂淚

你的Tapable沒有構(gòu)造函數(shù)constructor,正確的寫法應(yīng)該是:

class Polygon {
  constructor(height, width) {
    this.name = 'Polygon';
    this.height = height;
    this.width = width;
  }
}

class Square extends Polygon {
  constructor(length) {
    super(length, length);
    this.name = 'Square';
  }
}
2017年5月28日 20:51