I have 3 files structure in the following order all of which contain 1 class
main.js extends events
events.js extends base
base.js
I've looked into these answers but my problem doesn't appear to look like anything of the following people described. TypeError: Class extends value undefined is not a function or null
main.js
const { Events } = require('./events.js');
module.exports = class Main extends Events {
constructor(token) {
super();
// Some code
}
}
events.js
const { Base } = require('./base.js');
module.exports = class Events extends Base {
constructor() {
super();
}
// more code
}
base.js
module.exports = class Base{
constructor() {
// Code
}
}
I'm unable initialize the main class in index.js as this results in the following error:
module.exports = class Events extends Base {
^
TypeError: Class extends value undefined is not a constructor or null
Am I somehow requiring the classes in a circular way? I'm not sure what I'm missing here.