I've taken QUITE some time to track down an issue. I have now found what I think the problem was - but I don't understand how/why it should have been a problem in the first place. It has to do with require(...).
//GeneralManager.js
//Dependancies
const Partie = require('./Partie');
const Joueur = require('./Joueur');
const listParties = []
const GeneralManager = {
  add_partie : function(partie_obj){
   //do stuff
},
  demarrer : function () {
    /*THIS is what I don't get - why doesn't the require above work?*/
    const Partie = require('./Partie')
    listParties.push(new Partie(new Joueur('Albert', 'Ramos', 28, 56, 'Espagne'), new Joueur('Milos', 'Raonic', 28, 16, 'Canada'), '1', 'Hale', '12h30', 0));
    //rest of demarrer metho 
     },
// rest of the object 
 }
module.exports = GeneralManager
//app.js
const GeneralManager = require('./src/GeneralManager')
const gm = GeneralManager
gm.demarrer()
The above works fine. However, if I comment the 2nd import of Partie inside the demarrer function, then I get: TypeError: Partie is not a constructor
How is it so? Do I really have to do multiple require() in each an every function where I need to build that object?
 
    