admin管理员组文章数量:1357678
Learning ES6 and have run in to the following error straight off Super expression must either be null or a function, not undefined.
Really unsure where my problem is, if anyone could help that would be great.
main.js
'use strict'
import Backbone from 'exoskeleton';
import App from './views/App';
var onDOMReady = () => {
console.log('inside dom ready');
window.app = new App();
}
if(document.readyState === 'complete' || document.readyState === 'interactive' || document.readyState === 'loaded' ) {
onDOMReady();
} else {
document.addEventListener('DOMContentLoaded', onDOMReady);
}
App.js
'use strict'
import Backbone from 'exoskeleton';
class App extends Backbone.View {
initialize () {
console.log('App: Init');
}
render () {
console.log('App: Render');
}
}
export default App;
Learning ES6 and have run in to the following error straight off Super expression must either be null or a function, not undefined.
Really unsure where my problem is, if anyone could help that would be great.
main.js
'use strict'
import Backbone from 'exoskeleton';
import App from './views/App';
var onDOMReady = () => {
console.log('inside dom ready');
window.app = new App();
}
if(document.readyState === 'complete' || document.readyState === 'interactive' || document.readyState === 'loaded' ) {
onDOMReady();
} else {
document.addEventListener('DOMContentLoaded', onDOMReady);
}
App.js
'use strict'
import Backbone from 'exoskeleton';
class App extends Backbone.View {
initialize () {
console.log('App: Init');
}
render () {
console.log('App: Render');
}
}
export default App;
Share
Improve this question
asked Feb 16, 2015 at 22:36
stylerstyler
16.5k25 gold badges85 silver badges139 bronze badges
8
|
Show 3 more comments
3 Answers
Reset to default 8I got this error because I had a circular import structure. One module importing another and the other way around.
Backbone.View
may be undefined in your case. The snippet that produces this error is this,
if (typeof parent !== "function" && parent !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof parent);
}
The issue for me was because I had used
import { EditForm } from '../EditForm'
instead of
import EditForm from '../EditForm'
To make matters worse the error message was complaining about a completely unrelated component that hadn't been modified in weeks. Safe to say this one caused me some headaches. Just think back to what you recently modified and the error is likely there.
本文标签:
版权声明:本文标题:javascript - Traceur runtime: Super expression must either be null or a function, not undefined - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738573241a2100726.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
super
, but rather the extends clause. – Bergi Commented Sep 28, 2015 at 12:24constructor () {super()}
. – Florian Wendelborn Commented Sep 7, 2016 at 19:20