对此错误一无所知:Uncaught TypeError:超级表达式必须为null或函数,而不是未定义

时间:2015-11-26 04:27:51

标签: javascript google-chrome-extension ecmascript-6 browserify babeljs

我正在构建一个Chrome扩展程序,因此我可以获得一些ECMASCript 6,但我在我的活动页面上收到此错误:

Uncaught TypeError: Super expression must either be null or a function, not undefined

我正在使用browserify + babelify来转换我的代码。

这是事件页面:( alarm.js ):

import ScrapperAlarm from './scrapper_alarm';
import {ALARMS} from '../config/const';

export default class Alarm {
    constructor( chrome_alarm ) {
        this.chrome_alarm = chrome_alarm;
    }

    run() {
        console.log( 'Alarm << %s >> run()', this.chrome_alarm.name );
    }

    static loadByChromeAlarm( chrome_alarm ) {
        switch( chrome_alarm.name ) {
            case ALARMS.SCRAPPER:
                return new ScrapperAlarm( chrome_alarm );
                break;
        }
    }
}

chrome.alarms.onAlarm.addListener( ( chrome_alarm ) => {
    alarm.loadByChromeAlarm( chrome_alarm ).run(); 
} );

chrome.alarms.create( ALARMS.SCRAPPER, { periodInMinutes: 1 } );

ScrapperAlarm定义为:( scrapper_alarm.js

import Alarm from './alarm';
import Scrapper from '../scrapper/scrapper';

class ScrapperAlarm extends Alarm {
    constructor() {
        super();
    }

    run() {
        super.run();
        this.scrapper = new Scrapper();
        this.scrapper.run();
    }
}

export default ScrapperAlarm;

调试错误,似乎发生在这里:

var ScrapperAlarm = (function (_Alarm) {
    _inherits(ScrapperAlarm, _Alarm); // <-- ERROR OCCURS HERE

我不确定怎么离开这里;任何帮助表示赞赏。

0 个答案:

没有答案