I am facing an issue with my code involving an interpreter:
//Interpreter.js
class Interpreter {
constructor() {
this.data = "data";
}
...
}
module.exports = Interpreter;
//index.js
const Interpreter = require('./interpreter/Interpreter');
...
var interpreter = new Interpreter();
// File.js
const Interpreter = require('./Interpreter');
...
var interpreter = new Interpreter();
When I try to initialize the interpreter in File.js, I encounter the following error:
TypeError: Interpreter is not a constructor
I am puzzled as to why this error is occurring and I am unsure how to resolve it. Any assistance would be greatly appreciated. Thank you.