'Undefined variable while exporting in Node.js

I'm getting undefined while exporting variables in Node.js. Don't understand why it isn't working any help or suggestions?

index.js

var test = 10;
module.exports.test = test;

config.js (inside "files" folder)

var includes = require('../index.js');
console.log(includes.test);


Solution 1:[1]

It's not module.exports.test. Try it like this.

module.exports = test

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1