I just want to point out that most of the answers here don't work, I am new to NodeJS and IDK if throughout time the "module.exports.yourClass" method changed, or if people just entered the wrong answer.
// MyClass
module.exports.Ninja = class Ninja{
test(){
console.log('TESTING 1... 2... 3...');
};
}
//Using MyClass in seprate File
const ninjaFw = require('./NinjaFw');
let ninja = new ninjaFw.Ninja();
ninja.test();
// Ninja Framework File
class Ninja{
test(){
console.log('TESTING 1... 2... 3...');
};
}
module.exports.Ninja = Ninja;