【发布时间】:2016-03-14 08:41:07
【问题描述】:
我正在使用 Gulp 运行 babelify 7.2.0,但在以下代码中出现错误:
class One {}
class Two extends One {
constructor() {
this.name = 'John';
}
}
这是错误的症结:
SyntaxError: [the file path in question]: 'this' is not allowed before super()
20 | class Two extends One {
21 | constructor() {
> 22 | this.name = 'John';
| ^
23 | }
24 | }
25 |
在我看来,这不应该被触发,因为我根本没有在构造函数中进行任何 super 调用,因此没有冲突的风险。我已经在 Github 上提交了一个问题,但我想知道是否有办法同时关闭它。
【问题讨论】:
标签: javascript gulp ecmascript-6 babeljs