Let's say, i have a class instance
const User = require(./User);
const id = '123456',
secret = '8787';
const user = new User(id, secret)
module.exports = user;
The problem is that whenever i import user, it just returns an empty object.
Why is this occurring and what should i do in this case?
This is what i'm using for testing
index.js file
const OAuthClient = require('disco-oauth'); //class disco-oauth
const credential = require('./credential.json');
//class instance
const oauthclient = new OAuthClient(credential.id,credential.secret);
console.log(oauthclient); //Working fine in here
module.exports = oauthclient; //exporting instance
test.js file
const oauthclient = require('./index')
console.log(oauthclient) //prints {}
Userthat you are requiring in your file? Also, how are you importing the generateduser?console.log(user)just bellowconst user = new User(id, secret). Does it print what you expect?const user = require(./user)This is how i'm importing it. @mgarcia